// BugArrayTester.java // Tests the user-defined abstract superclass Bug and various subclasses // Example of dynamic method binding and polymorphism import java.awt.*; import java.awt.event.*; import javax.swing.*; public class BugArrayTester extends JApplet { // GUI Container c; JPanel pGUI; BugArrayPanel pD; JButton b; public void init( ) { c = getContentPane( ); pGUI = new JPanel( ); b = new JButton( "Bugs" ); b.addActionListener( new ActionListener( ) { public void actionPerformed( ActionEvent e ) { pD.repaint( ); } } ); pGUI.add( b ); c.add( pGUI, BorderLayout.NORTH ); pD = new BugArrayPanel( ); c.add( pD, BorderLayout.CENTER ); } }