Chapter 16. Swing

Swing is Java’s graphical user interface toolkit. The javax.swing package (and its numerous subpackages) contain classes representing interface items such as windows, buttons, combo boxes, trees, tables, and menus—everything you need to build a modern, rich client-side application.[*]

Swing is part of a larger collection of software called the Java Foundation Classes (JFC), which includes the following APIs:

  • The Abstract Window Toolkit (AWT), the original user interface toolkit and base graphics classes

  • Swing, the pure Java 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 one of the largest and most complex parts 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 17 discusses the basic components from which user interfaces are built: buttons, lists, text fields, checkboxes, and so on.

  • Chapter 18 dives further into the Swing toolkit, describing text components, trees, tables, and other advanced components.

  • Chapter 19 discusses layout managers, which are ...

Get Learning Java, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.