int height = getHeight();
// Ensure that the popup remains within the bounds of the display
Point buttonLocation = colorChooserButton.mapPointToAncestor(display, 0, 0);
Dimensions displaySize = display.getSize();
colorChooserPopup.setPreferredSize(-1, -1);
Dimensions popupSize = colorChooserPopup.getPreferredSize();
int popupWidth = Math.max(popupSize.width,
colorChooserButton.getWidth() - TRIGGER_WIDTH - 1);
int popupHeight = popupSize.height;
int x = buttonLocation.x;