/** * Prepares the component for drawing. This recursively disables the double-buffering as this * would interfere with the drawing. * * @param c the component that should be prepared. */ private void prepareComponent(final Component c) { if (c instanceof JComponent) { final JComponent jc = (JComponent) c; jc.setDoubleBuffered(false); final Component[] childs = jc.getComponents(); for (int i = 0; i < childs.length; i++) { final Component child = childs[i]; prepareComponent(child); } } }
/** * Defines the component that should be drawn. * * @param component the component. */ public void setComponent(final Component component) { this.component = component; prepareComponent(component); }