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

inactive internal frames and propogation of mouse events

    XMLWordPrintable

Details

    Description

      We currently have a problem where the strategy to target mouse events to
      specific components in internal frames seems to differ if the internal
      frame is in-focus or out-of-focus.

      The problem seems to occur as we rely on the fact that mouse events
      are propagate upwards in the Component hierarchy when children components
      are not interested in those events.

      This behavior changes when inactive internal frames come into play:

      A normaly active frame will behave properly and will propagte the events
      upwards as it should when a child is set to ignore all mouse events.

      On the flip side, when an internal frame goes inactive, the mouse events
      are directly targeted to the child component even when that child
      does not require them.

      Please see the attached Main.java testcase. This example outlines a problem with Mouse Event propagation in Java with internal Frame.
      Run this class and set the "Frame With ToolTip" active. Putting the Mouse Cursor anywhere in the frame will show the tooltip (especially over the label).

      If you put the "Frame With ToolTip" inactive (by selecting the dummy frame) while keeping it still visible and then try to show the tooltip by moving the mouse cursor over the label, then no tooltip will comes up. Yet if you move the cursor over the panel, the tooltip will come up.

      We trace the code to two different ways of targeting Components:

      1) In normal behavior (the case where an inactive frame is active)
         The targeting of the component is done by Container.java's
         getMouseEventTarget : We can see ( build 1.3.1_01 and 1.4beta3) that the
         algorithm has a provison to travers the hierarchy upwards when
         a potential target (a child) will ignore the event.

      2) The alternate behavior occurs when, in BasicInternalFrameUI,
         the GlassPaneDispatcher's findComponentAt locates the component
         (regardless of it's interest in the event) and then dispatches
         the event.

      It would be "better" if there was a clean way for the GlassPaneDispatcher
      to figure out if the component is interested with the given event
      before accepting it as the target of the event. Unfortunaly,
      there is currently no way to access "eventEnabled" on Component as
      it is package private.

      Attachments

        Issue Links

          Activity

            People

              mbronsonsunw Mike Bronson (Inactive)
              rramchansunw Rajesh Ramchandani (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Imported:
                Indexed: