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

JComboBox with Vector for items doesn't show any item at first

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.2.0
    • 1.2.0
    • client-libs
    • swing1.1
    • sparc
    • solaris_2.6

      JComboBox with Vector for items doesn't show any item at first. This occurs with Swing-1.0.2 and JDK1.1.6 on Solaris 2.6 and Windows NT.

      Steps to Reproduce:
      0) Launch the code below with the configuration above.
      1) Look at and make selections from the popup in the JComboBox.
      RESULT: When you first look at the JComboBox, it looks like nothing is in it. However, after you make a selection, then it appears at the top.

      import java.awt.*;
      import java.awt.event.*;
      import com.sun.java.swing.*;
      import java.util.Vector;

      public class ComboVector extends JFrame {
       Vector vector = new Vector();
       JPanel panel = new JPanel();

       public ComboVector() {
        vector.addElement("Top");
        vector.addElement("Center");
        vector.addElement("Bottom");
        JComboBox box = new JComboBox(vector);
        box.setPreferredSize(new Dimension(250,70));
        setSize(400,500);
        panel.setPreferredSize(new Dimension(400,300));
        panel.add(box);
         getContentPane().add(panel);
         pack();
         setVisible(true);
        }

        public static void main(String args[]) {
           JFrame f = new ComboVector();

           f.addWindowListener(new WindowAdapter() {
             public void windowClosing(WindowEvent e) { System.exit(0); } });
        }

      }

            tsantossunw Tom Santos (Inactive)
            nschorrsunw Nancy Schorr (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: