I NEED TO KNOW HOW TO GET THE CHOSEN RADIO BUTTON.MAYBE THE COUNTERPART OF getText FOR RADIO BUTTON... I HAVE ONLY MALE AND FEMALE.
iammet
0
Newbie Poster
Recommended Answers
Jump to PostgetSelection() method for the ButtonGroup that they are both in.
Jump to PostIn what way doesn't it work? Please be specific. Does it print Male or Female?
The else on line 45 goes with the if on line 41, which seems unlikely to be what you intended.
Jump to Postthe way i got round finding out which radio button is selected is to create a method that returns which radio button is selected
private String RadioSelected() { if(radio1.isSelected() { return radio1.getText(); } if(radio2.isSelected() { return radio2.getText(); } return null; }
this is only a good idea …
All 11 Replies
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
iammet
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
iammet
0
Newbie Poster
ajst
18
Junior Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
ajst
18
Junior Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
ajst
18
Junior Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
ajst
18
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.