// JavaScript Document

//In initialization code:
    //Create the radio buttons.
    JRadioButton birdButton = new JRadioButton(birdString);
    vote1Button.setMnemonic(KeyEvent.VK_Y);
    vote1Button.setActionCommand(birdString);
    vote1Button.setSelected(true);

    JRadioButton catButton = new JRadioButton(catString);
    vote2Button.setMnemonic(KeyEvent.VK_N);
    vote2Button.setActionCommand(catString);

  

    //Group the radio buttons.
    ButtonGroup group = new ButtonGroup();
    group.add(vote1Button);
    group.add(vote2Button);
   

    //Register a listener for the radio buttons.
    vote1Button.addActionListener(this);
    vote2Button.addActionListener(this);
  
...
public void actionPerformed(ActionEvent e) {
    picture.setIcon(new ImageIcon("images/" 
                                  + e.getActionCommand() 
                                  + ".gif"));
}

