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

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -