/** 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); }
public void setLocation(int x, int y) { shift_x = x; shift_y = y; super.setLocation(x, y); }