/** * Paints this Figure's children. The caller must save the state of the graphics prior to calling * this method, such that <code>graphics.restoreState()</code> may be called safely, and doing so * will return the graphics to its original state when the method was entered. * * <p>This method must leave the Graphics in its original state upon return. * * @param graphics the graphics used to paint * @since 2.0 */ protected void paintChildren(Graphics graphics) { IFigure child; Rectangle clip = Rectangle.SINGLETON; for (int i = 0; i < children.size(); i++) { child = (IFigure) children.get(i); if (child.isVisible() && child.intersects(graphics.getClip(clip))) { graphics.clipRect(child.getBounds()); child.paint(graphics); graphics.restoreState(); } } }