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
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 ?