Reputation: 7202
I need to create the JMenu
which should have:
submenu
itemscheckbox
.Like this:
Is there any easy way to create it or I have to learn the core first merge the JCheckBoxMenuItem
and JMenu
classes?
PS: Yes, I know that I can try it myself and I'll create it after ~2 days of coding. I've just asked for the easy way or the turnkey solution.
Upvotes: 1
Views: 923
Reputation: 42176
You can associate an icon with any menu. The easiest way to do this might be to just use a regular MenuItem and set its icon to either a checked or unchecked checkbox whenever it is clicked. You might put that logic in a subclass of JMenu and use that class.
http://docs.oracle.com/javase/tutorial/uiswing/components/menu.html
Upvotes: 1