Monday, 10 September 2012

Radio Button and Button Group in java

Posted by Unknown On 05:31 | No comments
 private javax.swing.JRadioButton female=new javax.swing.JRadioButton();

 private javax.swing.JRadioButton male=new javax.swing.JRadioButton();

 private javax.swing.ButtonGroup sex= new javax.swing.ButtonGroup();

  sex.add(female);

 sex.add(male);

String str;

if(male.isSelected())

str="M";
else if (female.isSelected())

str="F";


str will have the datails of the selected Butto

0 comments:

Post a Comment

Blogroll

Blogger templates

About