コード例 #1
0
  /** Records a new size. Called by the AWT. */
  public void setBounds(int x, int y, int width, int height) {
    Insets insets = getInsets();
    int w;
    int h;

    if (source == null) {
      w = width;
      h = height;
    } else {
      w = source.getWidth();
      h = source.getHeight();

      if (width < w) {
        w = width;
      }

      if (height < h) {
        h = height;
      }
    }

    componentWidth = w + insets.left + insets.right;
    componentHeight = h + insets.top + insets.bottom;

    super.setBounds(x + shift_x, y + shift_y, componentWidth, componentHeight);
  }
コード例 #2
0
 /**
  * Reshape the receiver. The offscreen Image is destroyed, the component is laid out and
  * repainted.
  *
  * @see java.awt.Component
  * @see layoutComponent
  */
 public void setBounds(int x, int y, int width, int height) {
   super.setBounds(x, y, width, height);
   layoutComponent();
   repaint();
 }