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

Many components respond to a mouse event by requesting focus without supplying the MOUSE_EVENT cause

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • 9
    • client-libs

      A focus event has an attribute that describes the cause of the focus transfer. One option is MOUSE_EVENT, which indicates that the focus transfer was triggered by a mouse event. Many Swing components request a focus transfer in response to a mouse event, but fail to supply a Cause when requesting focus. A focus event listener will find the cause to be UNKNOWN, but MOUSE_EVENT would be more appropriate.

      I have found this problem in:
      Text Components (see DefaultCaret)
      BasicButtonListener
      BasicComboPopup (see Handler and delegateFocus)
      BasicScrollBarUI (see TrackListener and ArrowButtonListener)
      BasicSliderUI (see TrackListener) and AquaSliderUI
      BasicSpinnerUI (see ArrowButtonHandler) and AquaSpinnerUI
      BasicTabbedPaneUI (see Handler)
      GTKColorChooserPanel (see ColorTriangle)
      AquaTextFieldSearch (see button listener)

      I also note that SwingUtilities2 has helper methods that request focus, but
      no equivalents that accept a Cause.

      I also note that Accessibility supports requestFocus without a cause.
      Should the cause be set to MOUSE_EVENT because Accessibility is basically
      simulating a mouse event, or should there be a Cause parameter so that other options can be supported?

            psadhukhan Prasanta Sadhukhan
            alans Alan Snyder
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: