JDK-6285881 : JTrayIcon: support Swing JPopupMenus for tray icons
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_xp
  • CPU: x86,itanium
  • Submitted: 2005-06-15
  • Updated: 2017-07-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
Other
tbd_majorUnresolved
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
A DESCRIPTION OF THE REQUEST :
Tray icons in Mustang support showing a PopupMenu.  By allowing to show a Swing JPopupMenu, we get additional features such as menu icons.

A solution would be to create a JTrayIcon class that was a subclass of TrayIcon that added additional constructors to take in a JPopupMenu and perhaps even a custom component for rendering a status message.  The JTrayIcon class could be in the javax.swing package tree, therefore there would be no AWT dependency on Swing.


JUSTIFICATION :
The ability to use a JPopupMenu for tray icons would provide additional functionality such as menu icons.


CUSTOMER SUBMITTED WORKAROUND :
A mouse listener could be registered with the tray icon that shows the JPopupMenu in a new window above the icon, however this involves additional work on the user's part.
###@###.### 2005-06-15 11:19:02 GMT

Comments
WORK AROUND Here is a piece of code that can be used to show JPopupMenu from tray icon: trayIcon.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { jpopup.setLocation(e.getX(), e.getY()); jpopup.setInvoker(jpopup); jpopup.setVisible(true); } } }); However, this will lead to the Java application doesn't shutdown automatically (see 6400183 for details). Another way is to set jpopup's invoker to null, but this also doesn't work (see 6421284 for details).
2006-05-05

EVALUATION Definitely something we plan to investigate.
2005-08-02