|
-
Aug 26th, 2006, 12:38 PM
#1
Thread Starter
Frenzied Member
Finding the radio button that have been clicked [*Resolved*]
Hello,
I have a user interface using swing. I have 3 radio buttons grouped (Economy, Business, First). I want to find which one the user has clicked. I have grouped the radio buttons and placed them inside a panel. I have added addItemListener to each one. I have used to the code below to print out the radio button that have been clicked. I want to print out either Economy, Business or First, depending on which one the user clicked.
All this code does is print out a load of rubbish, each time a radio button is clicked. Not sure why.
VB Code:
public void itemStateChanged(ItemEvent event)
{
String item = "";
if ( event.getStateChange() == ItemEvent.SELECTED )
{
item = event.getItem().toString();
System.out.println("Radio Button: " + item);
}
}
Thanks in advance,
Steve
Last edited by steve_rm; Sep 4th, 2006 at 06:34 AM.
steve
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|