Component child = children[i]; ComponentPeer peer = child.getPeer(); boolean translated = false; boolean clipped = false; Shape oldClip = g.getClip();
int width = awtComponent.getWidth(); int height = awtComponent.getHeight(); if (backbuffer == null || backbuffer.getWidth(awtComponent) < width || backbuffer.getHeight(awtComponent) < height) backbuffer = awtComponent.createImage(width, height); Graphics g2 = backbuffer.getGraphics(); Rectangle clip = g.getClipRect();
  protected void peerPaint(Graphics g)  {    Container c = (Container) awtComponent;    Component[] children = c.getComponents();    for (int i = children.length - 1; i >= 0; --i)      {        Component child = children[i];        ComponentPeer peer = child.getPeer();        boolean translated = false;        boolean clipped = false;        Shape oldClip = g.getClip();        try        {          g.translate(child.getX(), child.getY());          translated = true;          g.setClip(0, 0, child.getWidth(), child.getHeight());          clipped = true;          if (peer instanceof SwingComponentPeer)            ((SwingComponentPeer) peer).peerPaint(g);        }        finally        {          if (translated)            g.translate(- child.getX(), - child.getY());          if (clipped)            g.setClip(oldClip);        }      }  }