public void setBounds(int x, int y, int w, int h) { if (_name == null) return; Rectangle oldBounds = getBounds(); _bigPort.setBounds(x, y, w, h); _cover.setBounds(x, y, w, h); Dimension stereoDim = _stereo.getMinimumSize(); Dimension nameDim = _name.getMinimumSize(); if (h < 50) { _upperRect.setBounds(x - 10, y + h / 6, 20, 10); _lowerRect.setBounds(x - 10, y + 3 * h / 6, 20, 10); } else { _upperRect.setBounds(x - 10, y + 13, 20, 10); _lowerRect.setBounds(x - 10, y + 39, 20, 10); } _stereo.setBounds(x + 1, y + 1, w - 2, stereoDim.height); _name.setBounds(x + 1, y + stereoDim.height - OVERLAP + 1, w - 2, nameDim.height); _x = x; _y = y; _w = w; _h = h; firePropChange("bounds", oldBounds, getBounds()); updateEdges(); }
/* Override setBounds to keep shapes looking right */ public void setBounds(int x, int y, int w, int h) { Rectangle oldBounds = getBounds(); if (w > h) h = 9; else w = 9; _bigPort.setBounds(x, y, w, h); _head.setBounds(x, y, w, h); calcBounds(); // _x = x; _y = y; _w = w; _h = h; updateEdges(); firePropChange("bounds", oldBounds, getBounds()); }