A good answer might be:

In the body of the actionPerformed() method.

Changing the Color of a Frame

We will fill in the actionPerformed() body so that clicking the button changes the color of the frame. To change the color of the drawing area of a container, use the method setBackground( Color c ) . You can use one of the pre-defined colors like this:

setBackground( Color.red )
Other pre-defined colors are Color.green, Color.blue, Color.yellow, and so on. Here is the interesting part of our program:

public class buttonDemo extends Frame implements ActionListener
{
  Button bChange = new Button("Click Me!"); // construct a Button

  buttonDemo()                           // constructor for buttonDemo
  {
    setLayout( new FlowLayout() );       // choose the layout manager 
    bChange.addActionListener( this );   // register the buttonDemo object
                                         // as the listener for its Button.
    add( bChange );                      // add the button to the container
  }
   
  public void actionPerformed( ActionEvent evt)
  {
    _________________________
    repaint();                           // ask the system to paint the screen.
  }

  public static void main ( String[] args )
  {
      . . . . .
  }
}

The repaint() will be explained in the next page.

QUESTION 9:

Fill in the blank so that the program changes the frame to blue when the button is clicked.

Click Here after you have answered the question