Eine gute Antwort könnte sein:

Since ButtonDemo2 implements the ActionListener interface, it must define each method in the interface.

Implementing an Interface

For the ActionListener interface, there is only one method: actionPerformed(). Here is the program with several blanks:

public class ButtonDemo2 extends JFrame implements _________________
{
  JButton bChange ;

  // constructor
  public ButtonDemo2()
  {
    getContentPane().setLayout( new FlowLayout() );
    bChange = new JButton("Click Me!");
    getContentPane().__________( bChange );
  }

  // listener method required by the interface
  public void ________________( ActionEvent evt)
  {
     . . . . . .
  }

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

FRAGE 11:

Fill in the blue blanks. Don't fill in the ". . . . . "

Inhaltsverzeichnis