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

Setting dialog nonresizable before pack in 1.2 causes a ridiculous dialog size

    Details

    • Subcomponent:
    • Resolved In Build:
      1.2.2
    • CPU:
      sparc
    • OS:
      solaris_2.5.1

      Description

      This works correctly in JDK1.1.7, but is broken in JDK1.2
      see also 4041679, which was raised against 1.1.x

      ------ DialogSize1.java ------

      /*
      ** On 1.1.7: The dialog box is set to the specified size at the expected
      ** position on the screen (near the parent window).
      **
      ** On 1.2: The dialog box takes up the whole screen.
      ** If setResizable(false) is commented out, then it is the
      ** correct size, but it appears at the top-left corner of the
      ** screen.
      **
      ** Note:
      ** pack() calls addNotify(), so this is essentially equivalent to
      **
      ** setResizable(false);
      ** pack();
      */

      import java.awt.*;

      public class DialogSize1 extends Dialog
      {
        public static void main(String argv[])
        {
          Frame fr = new Frame();
          fr.setSize(300,200);
          fr.setVisible(true);
          new DialogSize1(fr, "Dialog Test", false).setVisible(true);
        }

        public DialogSize1(Frame parent, String title, boolean modal)
        {
          super(parent, title, modal);

          setResizable(false);
          addNotify();
          setSize(100,50);
        }
      }


      ------ DialogSize2.java ------

      /*
      ** On 1.1.7: The dialog box is set to the specified size at the expected
      ** position on the screen (near the parent window).
      **
      ** On 1.2: The dialog box is set to the specified size, but it
      ** appears at the top-left corner of the screen.
      ** Same behaviour if setResizable(false) is commented out.
      */

      import java.awt.*;

      public class DialogSize2 extends Dialog
      {
        public static void main(String argv[])
        {
          Frame fr = new Frame();
          fr.setSize(300,200);
          fr.setVisible(true);
          new DialogSize2(fr, "Dialog Test", false).setVisible(true);
        }

        public DialogSize2(Frame parent, String title, boolean modal)
        {
          super(parent, title, modal);

          addNotify();
          setResizable(false);
          setSize(100,50);
        }
      }
      ------ DialogSize3.java ------

      /*
      ** On 1.1.7: The dialog box is set to the specified size at the expected
      ** position on the screen (near the parent window).
      **
      ** On 1.2: The dialog box is the correct size, but comes up in
      ** unexpected positions on the screen.
      ** If 'setResizable(false)' is commented out, it appears at the
      ** top-left corner of the screen.
      */

      import java.awt.*;

      public class DialogSize3 extends Dialog
      {
        public static void main(String argv[])
        {
          Frame fr = new Frame();
          fr.setSize(300,200);
          fr.setVisible(true);
          new DialogSize3(fr, "Dialog Test", false).setVisible(true);
        }

        public DialogSize3(Frame parent, String title, boolean modal)
        {
          super(parent, title, modal);

          setResizable(false);
          setSize(100,50);
          addNotify();
        }
      }




      adele.carrie@ireland 1998-10-20

        Attachments

          Activity

            People

            • Assignee:
              bklocksunw Brian Klock (Inactive)
              Reporter:
              acarrie Adele Carrie
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: