import java.awt.*; import java.applet.*; import java.awt.event.*; public class Ex2Template extends Applet implements ActionListener { Button larger = new Button("Larger"); Button smaller = new Button("Smaller"); // put the declaration for the Ferry here // you'll also need variables to keep track of the changing width and height /** * Init gets called automatically when the applet first starts */ public void init() { /** Makes the buttons appear in the applet **/ add(larger); add(smaller); /** Makes the method "actionPerformed" get called if the buttons are pressed **/ larger.addActionListener(this); smaller.addActionListener(this); } /** * Any drawing is done here. It is also where you should set the Ferry visible */ public void paint(Graphics g) { } /** * This method will get called everytime the user presses one of you buttons */ public void actionPerformed(ActionEvent e) { /** See if it was the larger button that was pressed **/ if (e.getSource() == larger) { // do what you need to do to change the size } /** See if smaller button was pressed **/ else if (e.getSource() == smaller) { // do what you need to do to change the size } } }