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

fp.bugs 3239: Dialog.show() generates Window Iconify and DeIconify events

XMLWordPrintable

    • 1.1.1
    • sparc
    • solaris_2.3
    • Not verified

      ###@###.### (Joe Slone)

      Solaris only: Dialog.show() generates extra WINDOW_MOVED, WINDOW_ICONIFY, and
      WINDOW_DEICONIFY events.

      Steps to reproduce
      Compile and run the attached code
      // Note: you will need /usr/green2/sqe/kas-tests/AppletFrame.java
      // Note standard output for events.

      import java.awt.*;
      import java.applet.*;

      public class DialogBug extends Applet
      {
         private final String OPEN_DIALOG = "Open Dialog";
         public DialogBug()
         {
            add( new Button(OPEN_DIALOG) );
         }

         public void init()
         {
            resize(400, 400);
         }

         public boolean action(Event evt, Object obj)
         {
            if( evt.target instanceof Button )
            {
               Container parentFrame = getParent();
               while( !( parentFrame instanceof Frame ) )
                  parentFrame = parentFrame.getParent();
               
               Dialog d = new MyDialog( (Frame) parentFrame, "Test Dialog", true);
               d.show();
               
               return true;
            }
            else
               return super.action(evt, obj);

        }

         public static void main(String argv[])
         {
            AppletFrame.startApplet("DialogBug", "Dialog bug", argv);
         }
      }

      class MyDialog extends Dialog
      {

         public MyDialog(Frame parent, String title, boolean modal)
         {
            super(parent, title, modal);
            resize(200, 200);
         }


         public boolean handleEvent(Event e)
         {
            switch(e.id)
            {
               case Event.WINDOW_DESTROY:
                  dispose();
                  return true;
                  
               case Event.WINDOW_ICONIFY :
                  System.out.println( "Window Iconify" );
                  break;
               case Event.WINDOW_DEICONIFY:
                  System.out.println("Window de-iconify");
                  break;
               case Event.WINDOW_EXPOSE:
                  System.out.println("Window Expose");
                  break;
               case Event.WINDOW_MOVED:
                  System.out.println("Window Moved");
                  break;
            }
            return super.handleEvent( e );

         }
      }

            amfowler Anne Fowler (Inactive)
            kasmithsunw Kevin Smith (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: