import java.awt.*; public class SubclassedComponent { public static void main (String[] args) { Frame window; MyButton myButton; window = new Frame("a vanilla Frame window"); myButton = new MyButton("I had to be subclassed"); window.setLayout(new FlowLayout()); window.add(myButton); window.resize(300,100); window.show(); } } // End of Class SubclassedComponent class MyButton extends Button { MyButton(String label) { super(label); } public boolean action (Event e, Object arg) { System.out.println("Pressed button: " + arg); return true; } } // End of Class MyButton