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

Windows don't get mouse events if parent frame hidden (1.1.x only/Solaris only)

    Details

    • Subcomponent:
    • CPU:
      x86, sparc
    • OS:
      solaris_2.5.1, solaris_2.6

      Description

      orig synopsis:
        "java.awt.Windows do not receive input if their parent frame is hidden."

      Name: diC59631 Date: 11/24/97


      On Solaris (ie., not on Windows NT), if an instance of java.awt.Window is created relative
      to a parent frame, and the parent frame is not
      visible, the Window will not receive any mouse
      events. (I havn't checked other input events.)
      Trying to implement custom popups with an
      invisible parent frame becomes a problem. I'm
      sure the JFC guys would like this fixed also.

      Note, this appears to be similar to bug 4058361,
      but it is worded incorrectly.

      Sample Code: Window 1 doesn't get events, Window
      2 does.


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

      import java.awt.*;
      import java.awt.event.*;

      /** Creates 2 Frames, each with a child window. Frame 1 is hidden,
       * while frame 2 is showing.
       * Window 1 is a child of Frame 1.
       * WIndow 2 is a child of Frame 2.
       *
       * BUG: Window 1 doesn't get any mouse events on Solaris.
       */
      public class WindowTest
      {
          public static void main(String argv[])
          {
      //// FRAME 1, WINDOW 1
      Frame frame = new Frame();
      Window win = new Window(frame);
      win.setLayout(null);
      Button b1 = new Button("Window 1");
      win.add(b1);
      b1.setBounds(10, 10, 70, 30);
      win.addMouseListener(new MousePrinter());
      //win.pack();
      win.setBounds(20,20, 90, 60);
      win.setVisible(true);

      //// FRAME 2, WINDOW 2
      frame = new Frame("Frame 2");
      frame.setBounds(300,300,50,50);
      // SHOW FRAME 2
      frame.setVisible(true);
      win = new Window(frame);
      win.setLayout(null);
      b1 = new Button("Window 2");
      win.add(b1);
      b1.setBounds(10, 10, 70, 30);
      win.addMouseListener(new MousePrinter());
      win.setBounds(20, 100, 90, 60);
      win.setVisible(true);
          }

          public static class MousePrinter extends MouseAdapter
          {
              public void mousePressed(MouseEvent me)
              { System.err.println(me); }
          }
      }
      (Review ID: 20723)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                prssunw Prs Prs (Inactive)
                Reporter:
                dindrigo Daniel Indrigo (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: