0

To set a JCheckBox is using setSelected method with a boolean condition. Which method do i use to get the boolean data out of the JCheckBox. Thanks

COD3BOY
  • 11,964
  • 1
  • 38
  • 56
The JAVA Noob
  • 367
  • 4
  • 8
  • 21

3 Answers3

4

Did you mean to check if the JCheckbox is selected? if so use isSelected()

You can also use an ItemListener in case you want to get notified about the check and uncheck!

COD3BOY
  • 11,964
  • 1
  • 38
  • 56
3

isSelected() is the method you looking for, I guess. This will return false if JCheckBox is NOT Selected and true if Selected.

nIcE cOw
  • 24,468
  • 7
  • 50
  • 143
3

This will help you.

Anuj Balan
  • 7,629
  • 23
  • 58
  • 92