@Override public void paint(Graphics2D graphics) { if (!doubleBuffering) { paint0(graphics); } else { if (doubleBufferImage == null) { GraphicsConfiguration gc = graphics.getDeviceConfiguration(); doubleBufferImage = gc.createCompatibleImage(getWidth(), getHeight(), Transparency.OPAQUE); doubleBufferedRepaintRequired = true; } // TODO use clipbounds Graphics2D bufferedImageGraphics = (Graphics2D)doubleBufferImage.getGraphics(); try { if (doubleBufferedRepaintRequired) { paint0(bufferedImageGraphics); doubleBufferedRepaintRequired = false; } graphics.drawImage(doubleBufferImage, 0, 0, null); } finally { bufferedImageGraphics.dispose(); } } }
@Override public void paint(Graphics2D graphics) { if (!doubleBuffering) { paint0(graphics); } else { boolean freshImage = false; if (doubleBufferImage == null) { GraphicsConfiguration gc = graphics.getDeviceConfiguration(); doubleBufferImage = gc.createCompatibleImage(getWidth(), getHeight(), Transparency.OPAQUE); doubleBufferedRepaintRequired = true; freshImage = true; } Graphics2D bufferedImageGraphics = (Graphics2D)doubleBufferImage.getGraphics(); try { if (doubleBufferedRepaintRequired) { if (!freshImage) { bufferedImageGraphics.setClip(graphics.getClip()); } paint0(bufferedImageGraphics); doubleBufferedRepaintRequired = false; } graphics.drawImage(doubleBufferImage, 0, 0, null); } finally { bufferedImageGraphics.dispose(); } } }
Bounds paintBounds = new Bounds(0, 0, getWidth(), getHeight()); Rectangle clipBounds = graphics.getClipBounds(); if (clipBounds != null) {
Bounds paintBounds = new Bounds(0, 0, getWidth(), getHeight()); Rectangle clipBounds = graphics.getClipBounds(); if (clipBounds != null) {