A good answer might be:

The blanks are filled in below:


Blanks filled In

public class ButtonDemo2 extends JFrame implements ActionListener
{
  JButton bChange;

  public buttonDemo2() 
  {
    getContentPane().setLayout( new FlowLayout() ); 
    bChange = new JButton("Click Me!"); 
    getContentPane().add( bChange ); 
  }
   
  public void actionPerformed( ActionEvent evt)
  {
     . . . . . .
  }

  public static void main ( String[] args )
  {
    ButtonDemo2 frm = new ButtonDemo2();
      . . . . .
  }
}

In this style of GUI programming, one object (the ButtonDemo2 object) is playing several roles: it is the container object, and it is also the listener object. However, implementing ActionListener is not enough. The listener must still be registered with the Button.

QUESTION 11:

(Review: ) What does registering a listener do?