/** * Paints this panel to fit the specified image. * @param image the image. */ public void paintToImage(BufferedImage image) { Graphics2D g2d = image.createGraphics(); // Set panel properties. g2d.setColor(getBackground()); g2d.fillRect(0,0,image.getWidth(),image.getHeight()); g2d.setColor(getForeground()); g2d.setFont(getFont()); // Turn on anti-aliasing. g2d.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // Paint this panel to fit the image. paintToRect(g2d,0,0,image.getWidth(),image.getHeight()); g2d.dispose(); }
public void paintToRect(Graphics2D g2d, int x, int y, int w, int h) { if (_split==null) { _panelTL.paintToRect(g2d,x,y,w,h); } else { double ws = (double)w/(double)_splitPane.getWidth(); double hs = (double)h/(double)_splitPane.getHeight(); int nc = _splitPane.getComponentCount(); for (int ic=0; ic<nc; ++ic) { Component c = _splitPane.getComponent(ic); int xc = c.getX(); int yc = c.getY(); int wc = c.getWidth(); int hc = c.getHeight(); xc = (int)round(xc*ws); yc = (int)round(yc*hs); wc = (int)round(wc*ws); hc = (int)round(hc*hs); if (c instanceof IPanel) { IPanel ip = (IPanel)c; ip.paintToRect(g2d,xc,yc,wc,hc); } } } } }
if (c instanceof IPanel) { IPanel ip = (IPanel)c; ip.paintToRect(g2d,xc,yc,wc,hc);
if (c instanceof IPanel) { IPanel ip = (IPanel)c; ip.paintToRect(g2d,xc,yc,wc,hc); if (wtb>0.0f && ip instanceof Tile) { Tile tile = (Tile)ip;