I add radio buttons to the form in the following way:
for (int i=1;i<vote.size();i++){ javax.swing.JRadioButton radio = new javax.swing.JRadioButton(vote.get(i).toString()); jPanel4.add(radio, i-1); buttonGroup1.add(radio); jPanel4.validate(); } How after that to learn the selected index?
vote - a list of signatures to the buttons. And the number of signatures is the number of buttons.