I have used an array of JRadioButtons and added them to the button group. I have used mouse Listener.
I have set the first element in the array of JRadiobuttons to true so that when I run my code the first RadioButton is selected. Now I want to display the selected JRadioButton value in a text field. So when I say buttongroup.getSelection().getActionCommand() it is not recognizing that my first RadioButton is selected .Instead if I select it again then it is displaying the value in the text field.
So my problem is how should I make the first RadioButton to be displayed in the textfield .