Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what radio button is on when OK is pressed?

Status
Not open for further replies.

ringd

Programmer
Jul 11, 2000
35
GB
Hello!

I'm creating a simple GUI which contains various elements such as JButtons (for OK and CANCEL) and JRadioButtons (for various options). The radio buttons are linked together via a ButtonGroup.

What I want to do is within the OK button listener, identify what radio button is pressed. In the button group, a button (and only one button) is always on.

I've tried this bit of code in the OK button listener (and it doesn't work! (returns a null)...

GUIInstance.radioGroup.getSelection().getActionCommand();

Can anyone help this JAVA newboy?

Cheers,
Dave.

Dave.Ring@barclays.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top