Get the text of the selected RadioButton

So here is my code:

private JRadioButton rEndpoint[];

private JRadioButton rb49201;

private JRadioButton rb49202;

private JRadioButton rb49203;

private ButtonGroup rbGroup;

.....

rb49201 =new JRadioButton ("49201");

c.gridx = 0;

c.gridy = 2;

pSTConnect.add(rb49201,c);

rb49201.setSelected(true);

rb49202 =new JRadioButton ("49202");

c.gridx = 1;

c.gridy = 2;

pSTConnect.add(rb49202,c);

rb49203 =new JRadioButton ("49203");

c.gridx = 2;

c.gridy = 2;

pSTConnect.add(rb49203,c);

rbGroup =new ButtonGroup();

rbGroup.add(rb49201);

rbGroup.add(rb49202);

rbGroup.add(rb49203);

JRadioButton rEndpoint[] ={rb49201,rb49202,rb49203};

....

String ep =

Now I need in the String ep the exact number that appears as text on the selected radio button (when the user is pressing another button).

Thanks a lot

ILAN

[1440 byte] By [Ilan_Yaniva] at [2007-11-26 17:46:19]
# 1
String ep = rbGroup.getSelection().getActionCommand();
max25a at 2007-7-9 5:15:24 > top of Java-index,Desktop,Core GUI APIs...
# 2
thanksIt works
Ilan_Yaniva at 2007-7-9 5:15:24 > top of Java-index,Desktop,Core GUI APIs...