I have this JCheckBoxMenuItem as a field:
private JCheckBoxMenuItem chckbxmntmDisableSending = new JCheckBoxMenuItem("Disable Sending");
I need to find out whether it is checked or not some time later, when doing something else (pressing the send button, basically). How do I get the value of this?
I've googled 'check value of JCheckBoxMenuItem', 'get boolean JCheckBoxMenuItem', others. I've also looked at the documentation, which says something about getState()
, but I am under the impression that getState()
only gives you whether it is selected by the mouse or not.
How do you get the current boolean value of a JCheckbox menu item? That is, whether it is checked or not?
According to Javadocs, the isSelected()
method will also return a boolean value for its state.