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

[macosx] Clicking with trackpad on Mac OS X on swing components generates java.awt.IllegalComponentStateException

XMLWordPrintable

    • x86
    • os_x

      FULL PRODUCT VERSION :
      1.8.0_45

      ADDITIONAL OS VERSION INFORMATION :
      OS X Yosemite version 10.10.4

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      trackpad with setting "tap for a clic"

      A DESCRIPTION OF THE PROBLEM :
      If you use some Swing component (perhaps in JavaFX too), perhaps like a JComboBox and you clic for a selection, you become a "java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location".

      After some hours of test, i see that comes only if you are setting "a tap make a clic" on global trackpad setting and you make tap on your java application. If you clic (not a tap) it's ok (with a true mouse, it's ok too). For me is clearly a bug in Java 8 (perhaps with 7 too).

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Use a JComboBox with some elements in model in a small Java Swing application
      2. Tap for a clic when you select an entry
      3. See the error message

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No IllegalComponentStateException with a tap for a clic in Mac OS.
      ACTUAL -
      IllegalComponentStateException

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location
      at java.awt.Component.getLocationOnScreen_NoTreeLock(Component.java:2054)
      at java.awt.Component.getLocationOnScreen(Component.java:2028)
      at sun.lwawt.macosx.CAccessibility$23.call(CAccessibility.java:395)
      at sun.lwawt.macosx.CAccessibility$23.call(CAccessibility.java:393)
      at sun.lwawt.macosx.LWCToolkit$CallableWrapper.run(LWCToolkit.java:598)
      at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744)
      at java.awt.EventQueue.access$400(EventQueue.java:97)
      at java.awt.EventQueue$3.run(EventQueue.java:697)
      at java.awt.EventQueue$3.run(EventQueue.java:691)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
      at java.awt.EventQueue$4.run(EventQueue.java:719)
      at java.awt.EventQueue$4.run(EventQueue.java:717)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:716)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      See example under :
      http://stackoverflow.com/questions/27016400/error-illegalcomponentstateexception-when-pressing-jmenuitem-in-java-swing-os
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      clic with the trackpad or use a mouse

            alexsch Alexandr Scherbatiy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: