How to disable Checkbox depending on another Checkbox?

razshan picture razshan · Mar 10, 2011 · Viewed 28.9k times · Source

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.

Answer

Brian Roach picture Brian Roach · Mar 10, 2011

JCheckBox.setEnabled(false)

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