if (radioButton.isSelected())
{
//do something
}
how to check my jradio button is selected or not using if statement... what is "isSelected" here ? sorry,im new to this stuff... tq
You can check radioButton selected or not by this code
if (radioButton.isSelected()) {
//do something
}else {
//do something
}
"isSelected()" is a boolean function used to check components selected or not if a component is selected it returns true and if not selected it returns false
For more: https://docs.oracle.com/javase/8/docs/api/javax/swing/AbstractButton.html#isSelected--