In my program, I want to uncheck all the checkboxes whenever this method is called. Can someone explain why it isn't working? Whenever I call this method the checkboxes are still selected.
private void nextQuestionButtonActionPerformed(java.awt.event.ActionEvent evt) {
clearOptions();
}
public void clearOptions ()
{
//Make sure the check boxes are not checked
optionA.setSelected(false);
optionB.setSelected(false);
optionC.setSelected(false);
optionD.setSelected(false);
}
Listener
toJCeckBoxes
show the associated actions also.. – Markswomanuncheck the all textboxes
, then you saythe checkboxes remain selected
and finally in your comment in the code you sayMake sure the radio buttons are not checked
. So what is it? You reference 3 different components (although I still don't know what a "textbox" is). If you want help then take the time to ask a well defined and clear question. – MyrtamyrtaceousI would just add 4 checkboxes to a UI and a button to a jFrame and call the clearOptions() method in the event of the button
. Exactly, so post the code that you wrote to do this. We don't have the time to write the code for you. It's called anSSCCE
. If you don't know this term then search the web. – MyrtamyrtaceousListener
to those checkboxes? – MarkswomanDoes this work?
Did you read up on a SSCCE? Obviously not. How does that code compile? Where do you create the components and add them to the frame? Did you add a println(..) staement in your method to see if the code is even being invoked. – MyrtamyrtaceousOptionsX
on Changing the state ofOptionA
like making all as selected true ifOptionA
is unSelected.. That might lead to such problem as well.. – MarkswomanSwing
and almost every answer that you write here :) . I learn many things from you. God bless you.. – Markswoman