JComboBox cb = new JComboBox();
cb.setFont(new Font("Dialog", Font.PLAIN, 24));
MyMetalComboBoxUI ui = new MyMetalComboBoxUI();
cb.setUI(ui);
MetalComboBoxButton button = (MetalComboBoxButton) ui.getArrowButton();
MetalComboBoxIcon icon = (MetalComboBoxIcon) button.getComboIcon();
Insets insets = button.getInsets();
int additionalWidth = insets.left + insets.right + 2;
int additionalHeight = insets.top + insets.bottom + 2;
int iconWidth = icon.getIconWidth() + 6; // a margin = 6 by trial and
// error
FontMetrics fm = cb.getFontMetrics(cb.getFont());
// the following width calculation is a guess. We know the value
// depends on the font size, and that it is relatively small, so after