void (Container parent) { JComboBox cb = (JComboBox)parent; if (arrowButton != null) { Rectangle bounds = cb.getBounds(); Insets cbInsets = cb.getInsets(); Dimension prefSize = arrowButton.getPreferredSize(); int buttonHeight = bounds.height - (cbInsets.top + cbInsets.bottom); double ar = (double)buttonHeight / prefSize.height; int buttonWidth = (int)Math.floor(prefSize.width * ar); int offset = (int)Math.round(ar - 1.0); arrowButton.setBounds(bounds.width - buttonWidth - cbInsets.right + offset, cbInsets.top, buttonWidth, buttonHeight); } layoutEditor(); }