FontMetrics fm = comboBox.getFontMetrics(comboBox.getFont()); int w = fm.charWidth(' ') + 2; int h = fm.getHeight() + 2; return new Dimension(w, h);
Component comp = DEFAULT_RENDERER.getListCellRendererComponent(listBox, " ", -1, false, false); currentValuePane.add(comp); comp.setFont(comboBox.getFont()); int h = comp.getPreferredSize().height; currentValuePane.remove(comp); return new Dimension(100, h);
  protected Dimension getDefaultSize()  {    // There is nothing in the spec to say how this method should be    // implemented...so I've done some guessing, written some Mauve tests,    // and written something that gives dimensions that are close to the     // reference implementation.    FontMetrics fm = comboBox.getFontMetrics(comboBox.getFont());    int w = fm.charWidth(' ') + 2;    int h = fm.getHeight() + 2;    return new Dimension(w, h);  }