public static JPanel createRadiobox(String boxlabel,String[] buttons,int initiallySelected,ActionListener al){
  JPanel jp=createPaletteJPanel(boxlabel);
  ButtonGroup buttongroup=new ButtonGroup();
  for (int j=0; j < buttons.length; j++) {
    JRadioButton jrb=new JRadioButton(buttons[j]);
    jrb.setActionCommand("" + j);
    jp.add(jrb);
    buttongroup.add(jrb);
    if (al != null) {
      jrb.addActionListener(al);
    }
    if (j == initiallySelected) {
      jrb.setSelected(true);
    }
 else {
      jrb.setSelected(false);
    }
  }
  return jp;
}

public static JPanel createRadiobox ( String boxlabel , String [ ] buttons , int initiallySelected , ActionListener al ) { JPanel jp = createPaletteJPanel ( boxlabel ) ; ButtonGroup buttongroup = new ButtonGroup ( ) ; for ( int j = 0 ; j < buttons . length ; j ++ ) { JRadioButton jrb = new JRadioButton ( buttons [ j ] ) ; jrb . setActionCommand ( "" + j ) ; jp . add ( jrb ) ; buttongroup . add ( jrb ) ; if ( al != null ) { jrb . addActionListener ( al ) ; } if ( j == initiallySelected ) { jrb . setSelected ( true ) ; } else { jrb . setSelected ( false ) ; } } return jp ; }
create a panel containing a radiobox .
