int oldwidth = this.width; int oldheight = this.height;  if (this.width == width && this.height == height) return; invalidate (); this.width = width; this.height = height; if (peer != null) peer.setBounds (x, y, width, height);   if (isLightweight()) { if (oldwidth != 0 && oldheight != 0 && parent != null) parent.repaint(x, y, oldwidth, oldheight); if (width != 0 && height != 0) repaint(); }  if (oldwidth != width || oldheight != height) { ComponentEvent ce = new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED); getToolkit().getSystemEventQueue().postEvent(ce); }
setBounds(this.x, this.y, width, height);
  public void resize(int width, int height)  {    int oldwidth = this.width;    int oldheight = this.height;    if (this.width == width && this.height == height)      return;    invalidate ();    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())      {        if (oldwidth != 0 && oldheight != 0 && parent != null)          parent.repaint(x, y, oldwidth, oldheight);        if (width != 0 && height != 0)          repaint();      }    if (oldwidth != width || oldheight != height)      {        ComponentEvent ce =          new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED);        getToolkit().getSystemEventQueue().postEvent(ce);      }	}