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 menuitems.

trying achieve menuitem:

image

a jmenuitem doesn't support submenus, need use jmenu (add jpopupmenu). see how use menus more details

for example...

enter image description here

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

Popular posts from this blog

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -

Hard vs. Soft Water: What's The Difference?

The Ten Most Livable Cities In The World