Rectangle oldBounds = new Rectangle(parent.getX() + oldx, parent.getY() + oldy, oldwidth, oldheight); Rectangle newBounds = new Rectangle(parent.getX() + x, parent.getY() + y, width, height);
Rectangle oldBounds = new Rectangle(oldx, oldy, oldwidth, oldheight); Rectangle newBounds = new Rectangle(x, y, width, height);
  public void reshape(int x, int y, int width, int height)  {    int oldx = this.x;    int oldy = this.y;    int oldwidth = this.width;    int oldheight = this.height;    if (this.x == x && this.y == y        && this.width == width && this.height == height)      return;    invalidate ();    this.x = x;    this.y = y;    this.width = width;    this.height = height;    if (peer != null)      peer.setBounds (x, y, width, height);    // Erase old bounds and repaint new bounds for lightweights.    if (isLightweight() && isShowing ())      {        if (parent != null)          {            Rectangle parentBounds = parent.getBounds();            Rectangle oldBounds = new Rectangle(parent.getX() + oldx,                                                parent.getY() + oldy,                                                oldwidth, oldheight);            Rectangle newBounds = new Rectangle(parent.getX() + x,                                                parent.getY() + y,                                                width, height);            Rectangle destroyed = oldBounds.union(newBounds);            if (!destroyed.isEmpty())              parent.repaint(0, destroyed.x, destroyed.y, destroyed.width,                             destroyed.height);          }      }    // Only post event if this component is visible and has changed size.    if (isShowing ()        && (oldx != x || oldy != y))      {        ComponentEvent ce = new ComponentEvent(this,                                               ComponentEvent.COMPONENT_MOVED);        getToolkit().getSystemEventQueue().postEvent(ce);      }    if (isShowing ()        && (oldwidth != width || oldheight != height))      {        ComponentEvent ce = new ComponentEvent(this,                                               ComponentEvent.COMPONENT_RESIZED);        getToolkit().getSystemEventQueue().postEvent(ce);      }	}