You might have said that each button needs its own listener. That would work, but we can use just one listener. First write a class definition for the container frame. Here is a skeleton:
import java.awt.*; import java.awt.event.*; import javax.swing.*; public class TwoButtons extends ________ implements _________ { . . . . more code will go here . . . . public static void main ( String[] args ) { TwoButtons demo = new __________ ; . . . . more code will go here . . . . demo.setSize( 200, 150 ); demo.setVisible( true ); } } . . . . more code will go here . . . .
For now, just decide what class this new one extends and what
interface it will implement.
Then fill in the constructor in main()