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

Frame.setSize() doesn't change the size if the window is in iconified state.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.1.7
    • 1.1.3
    • client-libs
    • None
    • b01
    • x86
    • windows_nt
    • Not verified



        Name: rlT66838 Date: 07/17/97


        Use the following code to reproduce the bug. This
        reproduces only on WindowsNt and Windows95
        platforms. It works fine on Solaris.

        //
        // Name
        // FrameSetSizeBug.java - A simple test case to reproduce the
        // Frame.setSize() bug.
        // Description
        // Setting size on a iconified window doesn't have any effect.
        // Steps to reproduce the bug :
        // [1] Save this code as "FrameSetSizeBug.java" and run it
        // [2] You will see two windows - Iconify the window with title "window2"
        // [3] Click the "resize" button in "window1"
        // [4] Deiconify the window
        // You will notice that the window2 size hasn't changed although action
        // event handler is setting size on window2.
        // Note : If you skip "step2", size is set properly.
        // NOTE
        // This bug reproduces only on Win32 platforms.
        //
         
        import java.awt.Frame;
        import java.awt.Button;
        import java.awt.BorderLayout;
        import java.awt.event.ActionEvent;
        import java.awt.event.ActionListener;
         
        public class FrameSetSizeBug
          implements ActionListener
        {
          Frame frame1;
          Frame frame2;
         
          // constructor
          public FrameSetSizeBug()
          {
            // create frame1
            frame1 = new Frame("window1");
         
            // add "Resize" button
            Button resize = new Button("resize");
            frame1.add(resize, BorderLayout.NORTH);
            resize.addActionListener(this); // add "Quit" button
            Button quit = new Button("quit");
            frame1.add(quit, BorderLayout.SOUTH);
            quit.addActionListener(this);
         
            frame1.setSize(100, 100);
            frame1.setLocation(10, 10);
         
            // create frame2
            frame2 = new Frame("window2");
            frame2.setLocation(140, 10);
            frame2.setSize(100, 100);
          }
         
          // shows both the windows
          public void show()
          {
            frame1.show();
            frame2.show();
          }
         
          // action event handler
          public void actionPerformed(ActionEvent e)
          {
            Button b = (Button) e.getSource();
         
            if (b.getLabel().equals("resize"))
            {
              System.out.println("setting window2 size to 200, 200");
              frame2.setSize(200, 200);
            }
            else // quit
            {
              System.exit(0);
            }
          }

          
          // main
          public static void main(String[] args)
          {
            FrameSetSizeBug foo = new FrameSetSizeBug();
            foo.show();
          }
        }
         



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

              rkhansunw Robi Khan (Inactive)
              rlewis Roger Lewis (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: