java - How to add submenu to MenuItem -
i'm trying add submenu menuitem
exists in popup menu in system tray. there way achieve this? i've found solutions submenus use jmenuitem
, , trayicon
accepts popupmenu
accepts menuitem
s.
trying achieve menuitem
:
a jmenuitem
doesn't support submenus, need use jmenu
(add jpopupmenu
). see how use menus more details
for example...
jpopupmenu popupmenu = new jpopupmenu(); jmenu devicemenu = new jmenu("add device"); devicemenu.add(new jmenuitem("add more...")); popupmenu.add(devicemenu); popupmenu.add(new jmenuitem("delete device")); popupmenu.add(new jmenuitem("fire")); popupmenu.add(new jmenuitem("fault")); popupmenu.add(new jmenuitem("supress"));
(obviously, you'll still need plugin functionality of this)
and trayicon accepts popupmenu accepts menuitems.
there's trick, have cheat little, take @ how popupmenu show when left-click on trayicon in java? example
Comments
Post a Comment