Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7124398

[macosx] JComboBox with Border has double height

XMLWordPrintable

      http://java.net/jira/browse/MACOSX_PORT-258 submitted 2011/08/10 by Igor Stolyarov
      JComboBox with Border has double height
      Test for reproducing issue:
      import javax.swing.BorderFactory;
      import javax.swing.JComboBox;
      import javax.swing.JFrame;
      import javax.swing.JPanel;
      import javax.swing.SwingUtilities;
      public class ComboBoxTest {
          public ComboBoxTest() throws Exception {
              SwingUtilities.invokeAndWait(new Runnable() {
                  @Override
                  public void run() { createAndShowGUI(); }
              });
          }
          private void createAndShowGUI() {
              JFrame frame = new JFrame("JComboBox with Border test");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              JPanel panel = new JPanel();
              String[] combo1Strings = { "This", "has", "no", "border" };
              JComboBox combo1 = new JComboBox(combo1Strings);
              combo1.setEditable(true);
              panel.add(combo1);
              String[] combo2Strings = { "This", "has", "a titled", "border" };
              JComboBox combo2 = new JComboBox(combo2Strings);
              combo2.setEditable(true);
              combo2.setBorder(BorderFactory.createTitledBorder("Double Height"));
              panel.add(combo2);
              String[] combo3Strings = { "This", "has", "a titled", "border", "and", "a holding", "JPanel" };
              JComboBox combo3 = new JComboBox(combo3Strings);
              combo3.setEditable(true);
              JPanel workaround = new JPanel();
              workaround.setBorder(BorderFactory.createTitledBorder("Workaround"));
              workaround.add(combo3);
              panel.add(workaround);
              frame.getContentPane().add(panel);
              frame.pack();
              frame.setVisible(true);
          }
          public static void main(String[] argv) throws Exception { new ComboBoxTest(); }
      }

            rmahajan Rajat Mahajan
            vasya Vassili Igouchkine (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: