void () { super.layoutButtons(); int dropDownWidth = 0; if (myDropDown != null) { Dimension preferredSize = myDropDown.getPreferredSize(); dropDownWidth = preferredSize.width - ourInset * 2; myDropDown.setBounds(new Rectangle(myCloseButton.getX() - ourInset * 2, 0, preferredSize.width, myButton.getHeight())); } Insets insets = myButton.getMargin(); insets.right += dropDownWidth; myButton.setMargin(insets); Rectangle closeButtonBounds = myCloseButton.getBounds(); closeButtonBounds.x += dropDownWidth; myCloseButton.setBounds(closeButtonBounds); Rectangle bounds = myButton.getBounds(); bounds.width += dropDownWidth; myButton.setBounds(bounds); setPreferredSize(bounds.getSize()); }