public void actionPerformed(ActionEvent event)
    {
        String command = event.getActionCommand();
        
        if (command.equals(COMMAND_NEXT))
        {
            if (showQuestion && card != null)
            {
                // Display the answer.
                showQuestion = false;
                labelQuestion.setText("");
                labelSymbol.setText(card.getAnswerLabel());
                loadSound(card.getAnswerSound());
            }
            else
            {
                // No card or answer is being displayed, get new card.
                getNextCard();
            }
        }
        else if (command.equals(COMMAND_REPLAY))
        {
            if (sound != null)
            {
                // Restart the audio clip.
                sound.stop();
                sound.setFramePosition(0);
                sound.start();
            }
        }
        else if (command.equals(COMMAND_MENU))
        {
            menuChanged = true;
            menu.update();
            
            // If the screen is blank, enable Next only if there are available cards.
            if (!showQuestion && card == null)
                buttonNext.setEnabled(menu.hasSelection());
        }
    }