Java Reference
In-Depth Information
17
“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 and
teach the basic techniques for using these classes to define GUIs. GUIs are windowing
interfaces that handle user input and output. GUI is pronounced “gooey” and stands
for graphical user interface . Entire topics have been written on Swing, so we will not
be able to give you a complete description of Swing in just three chapters. However, we
will teach you enough to allow you to write a variety of windowing interfaces.
Swing
GUI
GUI
Windowing systems that interact with the user are often called GUIs . GUI is pronounced
“gooey” and stands for graphical user interface .
AWT
The AWT (Abstract Window Toolkit) 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 event-driven programming . Our first section begins with a brief
overview of event-driven programming.
Prerequisites
Before covering this chapter (and the two chapters on applets 1 and more Swing), you
need to have read Chapters 1 through 5 , Chapter 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 of this chapter, 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.
1 The chapter on applets is on the website that accompanies this topic.
 
Search WWH ::




Custom Search