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

Swing - pack() method not working for JDialog

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • client-libs



      Name: rk38400 Date: 05/13/98


      Callling the pack method on a JDialog has no effect.
      The JDialog will take up the whole screen size (it works properly on Win 95).

      Example:

      public class ExampleDialog extends JDialog {

      private GridLayout gridbag;
      private JButton done;
      private JPanel jPanel;

      public ExampleDialog(JFrame topFrame, String title, int x, int y) {

      super(topFrame, title, true);

      // Create panel to add all the components.
      jPanel = new JPanel();
      jPanel.setLayout(gridbag = new GridLayout());

      // Add button to dialog box and add button listener.
      done = new JButton("Ok");
      done.addActionListener(this);
      done.setBorder(BorderFactory.createEtchedBorder());
      done.setPreferredSize(new Dimension(45, 25));
      jPanel.add(done);

      getContentPane().add(jPanel);
      setLocation(x, y);
      setResizable(false);
      pack();
      show();
      }
      }

      No error message.
      No trace info.

      Solaris 2.6
      (Review ID: 29724)
      ======================================================================

            amfowler Anne Fowler (Inactive)
            rkarsunw Ralph Kar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: