Home > Enterprise >  How to say if JCheckBox is unselected
How to say if JCheckBox is unselected

Time:10-25

I have not got a any code but was just wondering how would I say that I have unselected a JCheckBox. I know how to say .isSelected() so was just wondering if there is any method or way to do unselected preferably using an ActionListener and not an ItemEvent any help greatly appreciated :)

CodePudding user response:

you can invert the result of .isSelected():

boolean isNotSelected = !cb.isSelected();

CodePudding user response:

try declaring a boolean var and pass it in to your method

boolean notSelected = !box.isSelected();
  • Related