Search code examples
javaswingjcheckbox

How to disable Checkbox depending on another Checkbox?


On Java, is there any way to disable a checkbox (call it B), if checkbox A is checked.

When I say disable, the user can't check it off..Its setEditable(false) or something.


Solution

  • JCheckBox.setEnabled(false)

    A tutortial showing exactly that is here: How to Use Buttons, Check Boxes, and Radio Buttons