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

win32: FileDialogs pass double clicks on to component underneath

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 1.0, 1.1
    • Fix Version/s: 1.1
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      1.1fcs
    • CPU:
      x86, sparc
    • OS:
      solaris_2.5, windows_95
    • Verification:
      Not verified

      Description



      Name: el35337 Date: 01/14/97

      When you double click on a file in
      a FileDialog, the second click is sent to the
      component positioned underneath the dialog at the
      position of the cursor. The dialog should consume
      the mouse clicks and disappear.
      The following stand-alone program illustrates the
      problem. It brings up a window which shows a
      number in the lower right hand corner. The number
      is incremented each time it detects a MOUSE_PRESSED
      event. If you hit the 'd' key on the keyboard a
      FileDialog will pop up. Double click on one of the
      files in the dialog. The dialog will disappear, as
      usual, and the click count will increment. The
      panel under the FileDialog receives a MOUSE_PRESSED
      and a MOUSE_RELEASED event when the user double
      clicks on a file in the dialog.
      ===================================================
      import java.awt.*;
      import java.awt.event.*;

      class Test
      // ====
      {
         public static void main (String args[])
         // ----
         {
            MyFrame frame = new MyFrame();
            frame.show();
         }

      } // end Test class



      class MyFrame extends Frame
      // =======
      {
         public MyFrame ()
         // -------
         {
            super("Test frame");
            enableEvents(AWTEvent.WINDOW_EVENT_MASK |
      AWTEvent.KEY_EVENT_MASK);
            Panel panel = new MyPanel();
            setSize(800, 600);
            add("Center", panel);
         }


         public boolean processKeyEvent (KeyEvent e)
         // ---------------
         {
            if (e.getId() == KeyEvent.KEY_TYPED)
               if (e.getKeyChar() == 'd')
               {
                  FileDialog dialog = new FileDialog(this);
                  dialog.show();
               }

               return super.processKeyEvent(e);
         }


         public void processWindowEvent (WindowEvent e)
         // ------------------
         {
            if (e.getId() == WindowEvent.WINDOW_CLOSING)
            {
               dispose();
               System.exit(0);
            }
         }

      } // end myFrame



      class MyPanel extends Panel
      // =======
      {
         int clickCount;


         public MyPanel ()
         // -------
         {
            enableEvents(AWTEvent.MOUSE_EVENT_MASK);
            clickCount = 0;
         }


         public boolean processMouseEvent (MouseEvent e)
         // -----------------
         {
            if (e.getId() == MouseEvent.MOUSE_PRESSED)
            {
               clickCount++;
               repaint();
            }

            return super.processMouseEvent(e);
         }


         public void paint (Graphics g)
         // -----
         {
            g.setFont(new Font("Dialog", Font.BOLD, 36));
            g.drawString((new Integer(clickCount)).toString(), 700, 550);
         }

      } // end MyPanel
      ===================================================

      Gray Matter Software, Inc. ###@###.###

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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tballsunw Tom Ball (Inactive)
              Reporter:
              elarsen Erik Larsen (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: