aspose file tools
The moose likes Swing / AWT / SWT and the fly likes actionCommand Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "actionCommand" Watch "actionCommand" New topic
Author

actionCommand

budsy remo
Ranch Hand

Joined: Sep 20, 2008
Posts: 103
when i call the Jradiobutton's getActionCommand , i recieve it's text as the string . Now when i add the radiobutton to buttongroup and then call the getSelection().getActionCommand() on button group i get the buttonmodel for that radiobutton . Now that model is set to null if don't explicitly call setActionCommand on the radiobutton .

Now here is the puzzling part :
the source code for getActionCommand is
String getActionCommand()
{
String ac=getModel().getActionCommand();
return ac;
}

it is calling the model and returning me the text when i call getActionCommand on JRadioButton but returns null if call getSelection().getActionCommand(). why so since by both the function calls i am doing the same thing ?
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4203
    
    3

Where did you get that source code? It's not what I see.

Also, please use the code tags to post code.


luck, db
There are no new questions, but there may be new answers.
budsy remo
Ranch Hand

Joined: Sep 20, 2008
Posts: 103
you will find it in the abstractButton class . That's where i found it . that's the superclass it extends.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4203
    
    3

Like I said, that's not the code I see when I look at AbstractButton#getActionCommand().

This is what I see:
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: actionCommand
 
Similar Threads
JButton Group
using getSelection()
insert to database...
Regarding RadioButton
javax.swing.ButtonGroup.getSelection()