Rectangle oldClip = g.getClipBounds (); g.setClip (oldClip.intersection (viewBounds));
Rectangle oldClip = g.getClipBounds(); g.setClip(portBounds);
  private void paintSimple(Graphics g,                            JViewport v,                            Component view,                            Point pos,                            Rectangle viewBounds,                            Rectangle portBounds)  {    Rectangle oldClip = g.getClipBounds ();    g.setClip (oldClip.intersection (viewBounds));    g.translate (-pos.x, -pos.y);    try      {           view.paint(g);      }     finally       {        g.translate (pos.x, pos.y);        g.setClip (oldClip);      }          }