Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Radio buttons

I have to radio buttons

JRadioButton s1=new JRadioButton("Default distance table"); s1.setSelected(true);
JRadioButton s2=new JRadioButton("User distance table");

ButtonGroup group=new ButtonGroup();
group.add(s1);
group.add(s2);

There is another NEXT button after the radio buttons. I want something to happen when s1 is selected and something else to happen if s2 is selected. Clicking the NEXT button will run the selected operation.

How do i code this?
[508 byte] By [Ant_Magma] at [2007-11-11 6:49:30]
# 1 Re: Radio buttons
Implement an actionListener for the container of the radiobuttons, add the
listener to the radiobuttons and do the stuff in the actionPerformed method
sjalle at 2007-11-11 22:40:11 >
# 2 Re: Radio buttons
Container of radio buttons in this case would be groups?
Ant_Magma at 2007-11-11 22:41:11 >