creation: 3/24/99 (using AWT); major revision: 01/08/02 (using Swing); minor changes: 02/07/04

CHAPTER 58 — Adding Buttons to a Frame

The previous chapters have introduced event-driven programming and the three parts of a GUI application:

  1. The Graphical User Interface:
    • Container objects--JFrame
    • Other objects--buttons, text fields, others.
  2. Listener methods:
    • Each GUI object has a listener object registered for it for each type of event it generates for which a response is expected.
  3. Application code.

This chapter discusses how to add a button to a frame and how to register a listener for its events.

Chapter Topics:

FRAGE 1:

What is the name of the Swing class that defines buttons?

Inhaltsverzeichnis