Graphics gfx2 = gfx.create(); gfx2.setClip(clip.x, clip.y, clip.width, clip.height); gfx2.translate(bounds.x, bounds.y);  visitor.visit(comp, gfx2); }
boolean clipped = false; boolean translated = false; try { gfx.setClip(clip.x, clip.y, clip.width, clip.height); clipped = true; gfx.translate(bounds.x, bounds.y); translated = true; visitor.visit(comp, gfx); } finally { if (translated) gfx.translate (-bounds.x, -bounds.y); if (clipped) gfx.setClip (oldClip.x, oldClip.y, oldClip.width, oldClip.height); } }
	private void visitChild(Graphics gfx, GfxVisitor visitor, Component comp) {		Rectangle bounds = comp.getBounds();		Rectangle clip = gfx.getClipBounds().intersection(bounds);		if (clip.isEmpty())			return;		Graphics gfx2 = gfx.create();		gfx2.setClip(clip.x, clip.y, clip.width, clip.height);		gfx2.translate(bounds.x, bounds.y);		visitor.visit(comp, gfx2);	}