-
Bug
-
Resolution: Fixed
-
P3
-
7
-
None
-
b27
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2162580 | 6u10 | Mikhail Lapshin | P3 | Resolved | Fixed | b26 |
There is one more place when we unsafely cast MouseEvent.getSource() to Component
and get ClassCastException is the source of the event is TrayIcon
(TrayIcon doesn't extend awt.Component)
Test to reproduce is here:
https://swinghelper.dev.java.net/source/browse/swinghelper/src/java/org/jdesktop/swinghelper/tray/JXTrayIcon.java?view=markup
For some reason it is reproduced only on Linux machines
Run this demo and click the red icon in the tray area
You'll have -
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: JXTrayIcon1 cannot be cast to java.awt.Component
at javax.swing.MenuSelectionManager.processMouseEvent(MenuSelectionManager.java:204)
at javax.swing.plaf.basic.BasicPopupMenuUI$MouseGrabber.eventDispatched(BasicPopupMenuUI.java:817)
at java.awt.Toolkit$SelectiveAWTEventListener.eventDispatched(Toolkit.java:2353)
and get ClassCastException is the source of the event is TrayIcon
(TrayIcon doesn't extend awt.Component)
Test to reproduce is here:
https://swinghelper.dev.java.net/source/browse/swinghelper/src/java/org/jdesktop/swinghelper/tray/JXTrayIcon.java?view=markup
For some reason it is reproduced only on Linux machines
Run this demo and click the red icon in the tray area
You'll have -
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: JXTrayIcon1 cannot be cast to java.awt.Component
at javax.swing.MenuSelectionManager.processMouseEvent(MenuSelectionManager.java:204)
at javax.swing.plaf.basic.BasicPopupMenuUI$MouseGrabber.eventDispatched(BasicPopupMenuUI.java:817)
at java.awt.Toolkit$SelectiveAWTEventListener.eventDispatched(Toolkit.java:2353)
- backported by
-
JDK-2162580 Even more ClassCasetException with TrayIcon
- Resolved
- relates to
-
JDK-6583251 One more ClassCastException in Swing with TrayIcon
- Closed