• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

actionCommand

 
budsy remo
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you get that source code? It's not what I see.

Also, please use the code tags to post code.
 
budsy remo
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you will find it in the abstractButton class . That's where i found it . that's the superclass it extends.
 
Darryl Burke
Bartender
Posts: 5125
11
Java Netbeans IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like I said, that's not the code I see when I look at AbstractButton#getActionCommand().

This is what I see:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic