|
Quick Lists
|
|
Bug ID:
|
6690791
|
|
Votes
|
0
|
|
Synopsis
|
Even more ClassCasetException with TrayIcon
|
|
Category
|
java:classes_swing
|
|
Reported Against
|
|
|
Release Fixed
|
7(b27)
|
|
State
|
10-Fix Delivered,
bug
|
|
Priority:
|
3-Medium
|
|
Related Bugs
|
6583251
|
|
Submit Date
|
18-APR-2008
|
|
Description
|
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)
Posted Date : 2008-04-18 14:04:55.0
|
|
Work Around
|
There are no workarounds.
|
|
Evaluation
|
see MenuSelectionManager.processMouseEvent()
the exact line is:
Component source = (Component)event.getSource();
we must use event.getComponent() instead and check it for null after that
Posted Date : 2008-04-18 14:03:11.0
I reproduced the bug on SuSe 10.3 and on Windows XP too.
Posted Date : 2008-04-29 12:33:45.0
|
|
Comments
|
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |