Java Reference
In-Depth Information
Introduction
In previous chapters, you learned that the Java GUI components—called Swing
components—provide a wide range of objects and methods to help program-
mers build user interfaces. Swing components include lightweight objects with
hundreds of methods that allow programmers to tailor windows using Java-
based components, such as option buttons, check boxes, lists, combo boxes, and
scroll bars.
In this chapter, you will learn how to design and create a program for a DVD
collection of classic movies, which will store the movie title, studio, and year the
movie was released. You also will learn how to use Swing components to create
the program's graphical user interface; use JMenu objects and methods to create
a user-friendly menu system that will allow users to add movies to the list; and
display the movies sorted in various ways.
In this chapter, you will also, learn how to use JComboBoxes that display as
drop-down lists in the interface and how to create an array of String variables to
populate the list displayed in each JComboBox. You will learn how to program
an efficient sort routine that quickly will alphabetize the elements in the array
for display.
As you learn how to use methods to check the state of various Swing
components, the program will display a formatted list with scrolling capabilities
in the interface. You will learn how to retrieve the selected item from the
JComboBox and have it display in a JScrollPane. You also will learn how to set
tabs, fonts, and styles of text. Finally, you will learn how to add a special Java
“look and feel” to the interface window.
Chapter Seven — Classics on DVD
An Internet-based collectors club wants to see a prototype of a program with a
graphical user interface that allows members to organize their classic movies on
DVD. Using the program, club members will be able to search and sort their
movies by title, studio, or year. They also will be able to add new movies to the
list.
The program will display a formatted list of the movies. Club members will
use the display to verify their collections. As users add new movies to the list, the
list must be sorted again to display alphabetically.
The Classics on DVD program interface (Figure 7-1) includes both a drop-
down list and a scrollable display. The commands available on the Edit menu
will allow users to add new movies to the list and search for specific movies. The
File menu includes a command that will allow users to exit the program.
Search WWH ::




Custom Search