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


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
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: 4664
    
    5

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: 4664
    
    5

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

This is what I see:
 
wood burning stoves
 
subject: actionCommand