示例#1
0
 public Dimension getPreferredSize(JComponent c) {
   Dimension size = super.getPreferredSize(c);
   if (comboBox.getGraphics() != null) {
     FontMetrics fm =
         Utilities.getFontMetrics(comboBox, comboBox.getGraphics(), comboBox.getFont());
     size.height = fm.getHeight() + 2;
     if (UIManager.getLookAndFeel() instanceof BaseLookAndFeel) {
       BaseLookAndFeel laf = (BaseLookAndFeel) UIManager.getLookAndFeel();
       size.height =
           Math.max(size.height, laf.getIconFactory().getDownArrowIcon().getIconHeight() + 2);
     }
   }
   return new Dimension(size.width + 2, size.height + 2);
 }