Chapter 13. Swing
Swing is Java’s user interface
toolkit. It was developed during the life of SDK 1.1 and now is part
of the core APIs in Java 2 (née JDK 1.2). Swing provides
classes representing interface items like windows, buttons, combo
boxes, trees, grids, and menus—everything you need to build a
user interface for your Java application. The
javax.swing
package (and its numerous subpackages)
contain the Swing user interface classes.[40]
Swing is part of a larger collection of software called the Java Foundation Classes (JFC). JFC includes the following APIs:
The Abstract Window Toolkit (AWT), the original user interface toolkit
Swing, the new user interface toolkit
Accessibility, which provides tools for integrating nonstandard input and output devices into your user interfaces
The 2D API, a comprehensive set of classes for high-quality drawing
Drag and Drop, an API that supports the drag-and-drop metaphor
JFC is the largest and most complicated part of the standard Java platform, so it shouldn’t be any surprise that we’ll take several chapters to discuss it. In fact, we won’t even get to talk about all of it, just the most important parts—Swing and the 2D API. Here’s the lay of the land:
This chapter covers the basic concepts you need to understand how to build user interfaces with Swing.
Chapter 14, discusses the basic components from which user interfaces are built: lists, text fields, checkboxes, and so on.
Chapter 15, dives further into the Swing toolkit, describing text ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access