How would I go about adding a Radio Button to a popup menu?
I want to have a TrayIcon
have a java.awt.PopupMenu
. I already know how do this part. But it appears that Java doesn't ha开发者_开发技巧ve a RadioButtonMenuItem
.
I already tried to add a JRadioButtonMenuItem
to it, but that resulted in many errors.
Is there a way that I could incorporate 3 "checkboxes" that do not allow more than 1 to be selected at a time and add it to my PopupMenu
?
My advice would be to use Swing - there's no reason I can see for using old AWT menus here. True TrayIcon
is part of java.awt
, but there is code around (see here) that works fine for me to integrate a swing menu with a TrayIcon.
And of course, once you're in swing territory you're away, just use JRadioButtonMenuItem
.
精彩评论