or… fight for code
getting mad on a java problem… 😦
I’m dynamically generating an interface.
But JRadioButton wants a final String as Action
… what can i do??? 😦
I have the whole day… let get dressed and have a coffee 😉
final String defaultMessageCommand = “default”;
final String yesNoCommand = “yesno”;
final String yeahNahCommand = “yeahnah”;
final String yncCommand = “ync”;for (int i = 0; i < questionario.getRisposte().length; i++) {
radioButtons[i] = new JRadioButton(
""+ i +". ” + questionario.getRisposte()[i] + ““);
radioButtons[i].setActionCommand(defaultMessageCommand);
group.add(radioButtons[i]);
}
i should dynamically generate “defaultMessageCommand” with something like “option” + i
…at the end i just need the int index value of the selected RadioButton … any idea?