go to previous page   go to home page   go to next page

Answer:

ButtonFrame implements the ActionListener interface, so it must define each method described in the interface.

Implementing an Interface

For the ActionListener interface, there is only one method: actionPerformed(). Here is the program with a start on adding a listener:

class ButtonFrame extends JFrame implements 
{
  JButton bChange ;

  // constructor   
  public ButtonFrame(String title) 
  {
    super( title );
    setLayout( new FlowLayout() );  

    bChange = new JButton("Click Me!"); 
    add( bChange ); 
    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );    
  }
   
  // listener method required by the interface
  public void ( ActionEvent evt)
  {
     . . . . . .
  }
}

QUESTION 11:

Fill in the blanks. (Don't fill in the ". . . . . ")