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

MetalComboBoxUI.getBaseline() unexpectedly throws IAE for width < 4

XMLWordPrintable

      Platform: ALL
      JDK: 6, 7

      The following code illustrates the problem

      ---------------------------------------------------------------
      import javax.swing.*;

      public class MetalGetBaseLine {
          public static void main(String[] args) {
              try {
                  UIManager.setLookAndFeel(
                      new javax.swing.plaf.metal.MetalLookAndFeel());
              } catch (UnsupportedLookAndFeelException e) {
                  e.printStackTrace();
              }
              new JComboBox().getBaseline(1, 3);
          }
      }
      ---------------------------------------------------------------
      Ouput will be

      Exception in thread "main" java.lang.IllegalArgumentException: Width and height must be >= 0
      at javax.swing.plaf.ComponentUI.getBaseline(ComponentUI.java:292)
      at javax.swing.plaf.basic.BasicComboBoxUI.getBaseline(BasicComboBoxUI.java:952)
      at javax.swing.plaf.metal.MetalComboBoxUI.getBaseline(MetalComboBoxUI.java:149)
      at javax.swing.JComponent.getBaseline(JComponent.java:2560)
      at MetalGetBaseLine.main(MetalGetBaseLine.java:10)

            rupashka Pavel Porvatov (Inactive)
            dbessono Dmitry Bessonov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: