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

JFrame doesn't display its contents until resize is done

XMLWordPrintable

    • generic
    • solaris_2.6

      Swing apps that uses JFrame no longer display its contents until the frame
      is resized. The following program should demonstrate the problem. It worked
      in jdk1.2 and other release before that.

      Roger Pham 12/8/99
      =============================================================================
      import java.awt.*;
      import javax.swing.*;
      import java.awt.event.*;


      public class Jlist {
          public static void main(String argv[]) {
      Jlist jm = new Jlist();
          }

          Jlist () {
      JFrame jf = new JFrame("JFrame");
      Container contentPane = jf.getContentPane();
      contentPane.setLayout(new FlowLayout());

      String []s = {"Choice 1",
      "Choice_2",
      "Will I pick the same thing in the future?",
                      };

      contentPane.add(new JList(s));

      JButton jb = new JButton("Quit");
      contentPane.add(jb);
      jb.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae) {
      System.exit(0);
      }
      });
       
      jf.setVisible(true);
      jf.setSize(250, 125);
          }
      }

            amfowler Anne Fowler (Inactive)
            rphamsunw Roger Pham (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: