Eine gute Antwort könnte sein:

It would not be unusual to miss a blank or two.

Complete Program

For such a complicated relationship diagram, this is a short program.

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class ButtonQuitter extends JFrame implements ActionListener
{
  JButton bQuit = new JButton("Click here to Exit");

  public ButtonQuitter()
  {
    getContentPane().setLayout( new FlowLayout() );
    bQuit.addActionListener( this );
    getContentPane().add( bQuit );
  }

  public void actionPerformed( ActionEvent evt)
  {
    System.exit( 0 );
  }

  public static void main ( String[] args )
  {
    ButtonQuitter frame = new ButtonQuitter();

    frame.setSize( 200, 150 );
    frame.setVisible( true );

  }
}

The program can be copied to a file, compiled and run in the usual way.

FRAGE 23:

How many times must you click the JButton for the program to exit?

Inhaltsverzeichnis