Java Reference
In-Depth Information
17
Swing I
“It Don't Mean a Thing If It Ain't Got That Swing”
SONG TITLE,
Duke Ellington
Introduction
This is the first of three chapters that present the basic classes in the
Swing
package
Swing
GUI
and teach the basic techniques for using these classes to define
GUIs.
GUIs
are win-
dowing interfaces that handle user input and output.
GUI
is pronounced “gooey” and
stands for
. Entire topics have been written on Swing, so we
will not have room to give you a complete description of Swing in three chapters.
However, we will teach you enough to allow you to write a variety of windowing
interfaces.
graphical user interface
GUI
Windowing systems that interact with the user are often called
GUIs
.
GUI
is pronounced
“gooey” and stands for
graphical user interface
.
) package is an older package designed for
doing windowing interfaces. Swing can be viewed as an improved version of the AWT.
However, Swing did not completely replace the AWT package. Some AWT classes are
replaced by Swing classes, but other AWT classes are needed when using Swing. We
will use classes from both Swing and the AWT.
Swing GUIs are designed using a particular form of object-oriented programming
that is known as
The
AW T
(
Abstract Window Toolkit
AW T
event-driven programming.
Our first section begins with a brief over-
view of event-driven programming.
Prerequisites
1
and more Swing), you
need to have covered Chapters 1 through 5, Chapters 7 (inheritance), Chapter 13
(interfaces and inner classes), and Section 8.2 of Chapter 8 (abstract classes). (Section
8.2 of Chapter 8 does not require Section 8.1.) Except for one subsection at the end of
this chapter, you need not have read any of the other chapters that precede this chapter.
To cover the last subsection entitled “A Swing Calculator,” you need to first read
Chapter 9, which covers exceptions. If you have not yet read Chapter 9, you can skip
that last section.
Before covering this chapter (and the two chapters on applets
1
The chapter on applets is on the CD that accompanies this topic.
Search WWH ::




Custom Search