Pages

Thursday, December 10, 2009

How to Check if Radio Button is Selected or Deselected in Java

***

I can't seem to find an easier way to do this, or perhaps this is the only way since RadioButton depends on the action listener. Here's my code:


private void radioButtonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
count++;
int ans = count%2;
if( ans == 0){
//radio button is deselected
}else{
//radio button is selected
}
}



***

0 comments:

Post a Comment