void resizeControl() { if (control != null && !control.isDisposed()) { /* * Set the size and location of the control * separately to minimize flashing in the * case where the control does not resize * to the size that was requested. This * case can occur when the control is a * combo box. */ Rectangle itemRect = getBounds(); control.setSize(itemRect.width, itemRect.height); Rectangle rect = control.getBounds(); rect.x = itemRect.x + (itemRect.width - rect.width) / 2; rect.y = itemRect.y + (itemRect.height - rect.height) / 2; control.setLocation(rect.x, rect.y); } }
void setBounds(int x, int y, int width, int height, boolean move, boolean size) { redraw(); int headerHeight = parent.getBandHeight(); if (move) { if (imageHeight > headerHeight) { y += (imageHeight - headerHeight); } this.x = x; this.y = y; redraw(); } if (size) { this.width = width; this.height = height; redraw(); } if (control != null && !control.isDisposed()) { if (move) control.setLocation(x + BORDER, y + headerHeight); if (size) control.setSize(Math.max(0, width - 2 * BORDER), Math.max(0, height - BORDER)); } }