// Fig. 11.4: ButtonHandler.java // Handle event for a button in the MyCanvas applet. import java.awt.event.*; public class ButtonHandler implements ActionListener { private CustomCanvas canvas; private int shape; public ButtonHandler( CustomCanvas c, int s ) { canvas = c; shape = s; } public void actionPerformed( ActionEvent e ) { canvas.draw( shape ); } }