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

BasicComboBoxUI getXXXXsize methods returns wrong values

XMLWordPrintable

    • beta
    • sparc
    • solaris_2.6



      Name: nkR10003 Date: 07/17/2000


      getXXXXsize methods (see list below) in class MetalFileChooser
      returns different values from one invocation to another. The program
      below demonstrates this.

      methods list:
          public Dimension getPreferredSize(JComponent c)
          public Dimension getMaximumSize(JComponent c)
          public Dimension getMinimumSize(JComponent c)

      %java -fullversion
      java full version "1.4.0beta-b22"
      ------------------example--------------------
      //ComboBoxExample.java
      //
      import javax.swing.*;
      import javax.swing.plaf.basic.*;
      import java.lang.reflect.*;
      public class ComboBoxExample {
          
          public static void main(String[] args) {
              try {
                  SwingUtilities.invokeAndWait(new Runnable() {
                      public synchronized void run() {
                          BasicComboBoxUI ui = new BasicComboBoxUI();
                          final JComboBox comboBox = new JComboBox();
                          comboBox.setUI(ui);
                          System.out.println("MinimumSize: "
                                  + comboBox.getUI().getMinimumSize(comboBox));
                          System.out.println("MaximumnSize: "
                                  + comboBox.getUI().getMaximumSize(comboBox));
                          System.out.println("PreferredSize: "
                                  + comboBox.getUI().getPreferredSize(comboBox));
                          System.out.println("================================"
                                  +"========================");
                          System.out.println("MinimumSize: "
                                  + comboBox.getUI().getMinimumSize(comboBox));
                          System.out.println("MaximumnSize: "
                                  + comboBox.getUI().getMaximumSize(comboBox));
                          System.out.println("PreferredSize: "
                                  + comboBox.getUI().getPreferredSize(comboBox));
                      }
                  });
              } catch (InterruptedException ie) {
                  ie.printStackTrace();
              } catch (InvocationTargetException ite) {
                  ite.printStackTrace();
              }
              System.exit(0);
          }
      }
      ----------------output:----------------------
      MinimumSize: java.awt.Dimension[width=24,height=19]
      MaximumnSize: java.awt.Dimension[width=32767,height=23]
      PreferredSize: java.awt.Dimension[width=32771,height=27]
      ========================================================
      MinimumSize: java.awt.Dimension[width=32771,height=27]
      MaximumnSize: java.awt.Dimension[width=32767,height=31]
      PreferredSize: java.awt.Dimension[width=32771,height=35]
      ---------------------------------------------
      The values in first three lines of output is rather different then others.

      ======================================================================

            mdavidsosunw Mark Davidson (Inactive)
            knasunw Kna Kna (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: