Setting up Animation Control Panel

		// Set up a BorderLayout manager
		setLayout(new BorderLayout());

		// Create a Panel to contain the play control buttons
		Panel controlPanel = new Panel();
		controlPanel.setLayout(new FlowLayout());
		controlPanel.add(m_stopButton);
		controlPanel.add(m_rewindButton);
		controlPanel.add(m_playButton);

		// Add the Control Panel to the applet layout
		add("South", controlPanel);

Event Handler that controls Interaction with the Animation

	// Javamation event handler reacts to control buttons
	public boolean handleEvent(Event evt)
	{
		// If the action was a button push...
		if (evt.target instanceof Button)
		{
			// ...check which button was pushed
			switch(evt.id)
			{
			case Event.ACTION_EVENT:
				Button button = (Button)evt.target;
				// If it was the Stop button...
				if(button.getLabel().equals("Stop"))
				{
					stop();
					break;
				}
				// If it was the Rewind button...
				else if(button.getLabel().equals("Rewind"))
				{
					stop();
					m_nFrameNumber = 0;
					repaint();
					break;
				}				
				// If it was the Play button...
				else if(button.getLabel().equals("Play"))
				{
					start();
					break;
				}
			default:
				return false;
			}
			return true;
		}
		else return false;
	}

Learn More

The complete applet source code.