0

I try to use the isChecked() method to identify whether a radio button is selected or not, and I get an error saying 'cannot find symbol'; I have imported java.awt.event.* so it's not that! It's probably something stupid but I'm really stuck!

if (beginner.isChecked()) 
{
   difficultyMark = 1;
}
else if (normal.isChecked()) 
{
   difficultyMark = 2;
} else {
   difficultyMark = 3;
}
MadProgrammer
  • 343,457
  • 22
  • 230
  • 366
JL9
  • 533
  • 3
  • 17
  • 2
    Because `JRadioButton` doesn't have a `isChecked` method. If you consulted the [JavaDocs](https://docs.oracle.com/javase/7/docs/api/javax/swing/JRadioButton.html), and [How to Use Buttons, Check Boxes, and Radio Buttons](http://docs.oracle.com/javase/tutorial/uiswing/components/button.html) tutorial, you would find that it uses [`isSelected`](https://docs.oracle.com/javase/7/docs/api/javax/swing/AbstractButton.html#isSelected()) instead – MadProgrammer Apr 07 '15 at 00:10
  • I did look at JavaDocs but I'm very new to programming and I didn't have a clue what I was looking at, what section of the JavaDocs do you look at to find this? – JL9 Apr 07 '15 at 00:14
  • aha, yes thank you that's sorted it, In future I will try and look more but I find the JavaDocs very baffling! – JL9 Apr 07 '15 at 00:16
  • Spend some time with the tutorials as well, that's why they are there. – MadProgrammer Apr 07 '15 at 00:17
  • Cheers, I appreciate your help, I will definitely look at some tutorials – JL9 Apr 07 '15 at 00:21

0 Answers0