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

One more ClassCastException in Swing with TrayIcon

XMLWordPrintable

    • b20
    • generic, x86
    • generic, windows_xp
    • Not verified

        Before JDK 6 all MouseEvents were generated by subclasses of awt.Component
        so it was safe to cast mouseEvent.getSource() to awt.Component,
        now it's not the case, because TrayIcon can generate MouseEvents
        and TrayIcon doesn't extends awt.Component
        so we get ClassCastException from several places

        like BasicPopupMenu.MouseGrabber.eventDispatched(AWTEvent ev)

        where we do Component src = (Component)ev.getSource();

        we should fix it and not cast ev.getSource() without checking

              alexp Alexander Potochkin (Inactive)
              alexp Alexander Potochkin (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: