0

(AWT) I have a frame with a text field + a checkbox group consisting of 8 checkboxes. I want to check a box, enter the text info, and perform an action. Then the 2nd time in I would like the text to remain as is and all of the boxes to be UN-checked. To that end, after the 1st action, I uncheck the box with "this:dispCB.setState(false)"; Unfortunately is doesn't uncheck anything, but if I simply check any other box, then it clears the last used box and I can go back and use it again. Not a good solution. Any suggestions? Thanks!

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
bioya1
  • 1
  • 2

1 Answers1

0

(AWT) I have a frame with a text field + a checkbox group consisting of 8 checkboxes

As you mentioned, since it a checkbox group, hence selecting another checkbox will uncheck the current checkbox by default. So, if you are trying to uncheck a checkbox, this may help; Suppose the name of your reference variable of the checkbox group is dispCB, then this will uncheck the selected checkbox:

dispCB.setSelectedCheckbox(null);
Mehul
  • 47
  • 5
  • Actually, I don't want the user to click on another box just to reset the one checked. There has to be a way, programmatically, to do this. Hence my question. – bioya1 Nov 28 '18 at 01:21
  • Oh, and per my original comments, this does *NOT* uncheck the box. It should, but it doesn't. – bioya1 Nov 28 '18 at 01:22