Getting the state of a menu tick box
Hi, I've created a menu tick box in my Java app. That was really easy and straight forward. Unfortunately I've had no luck in getting the state of the tick box menu (ticked or not).
Any help would be much appreciated.
Thanks.
My tick box menu code.
Code:
// create the Connections menu
JMenu connections = new JMenu("Connections");
connections.setMnemonic(KeyEvent.VK_O);
connections.add(new JCheckBoxMenuItem("Transmitter", true));
connections.add(new JCheckBoxMenuItem("Reciever", true));
Re: Getting the state of a menu tick box
Quote:
Originally posted by the-beast
Hi, I've created a menu tick box in my Java app. That was really easy and straight forward. Unfortunately I've had no luck in getting the state of the tick box menu (ticked or not).
Any help would be much appreciated.
Thanks.
My tick box menu code.
Code:
// create the Connections menu
JMenu connections = new JMenu("Connections");
connections.setMnemonic(KeyEvent.VK_O);
connections.add(new JCheckBoxMenuItem("Transmitter", true));
connections.add(new JCheckBoxMenuItem("Reciever", true));
Create the menuChackboxes as global variables, and then add them to your menu.
That way, you will have access to them from anywhere in your code.
tHE WAY YOU DO IT NOW, YOU WON'T HAVE ANY REFERENCE TO THEM IN YOUR ACTUAL CODE.