Get Under the Hood with Swing and the JFC

Digs deeper than any other Swing book, well written, accessible, complete, extensive text component coverage.


I love Swing and I’ve read every book I know of about the subject, and I have to say that this book is the best to date. Besides providing comprehensive, easy to digest lay-of-the-land, and covering each of the components in detail, this books dives under the hood in enough important areas to make it an indispensable tool for any JFC developer. The text components alone are given seven full chapters of coverage, explaining virtually anything you ever wanted to know about them. The pluggable look-and-feel, undo facilities and accessibility API are covered in their own chapters and an additional chapter on Swing utility classes rounds out the mix in inimitable style.

Chapter 1, "Introducing Swing", provides the usual orientation, talking about the JFC (Java Foundation Classes), pluggable look-and-feel, lightweight components, Swing packages, the MVC (Model View Controller) design pattern, and threading issues under Swing. Chapter 2, "Jump Start a Swing Application", briefly looks at what it takes to convert AWT applications to the JFC. Chapter 3, "Swing Component Basics", covers Actions - a key technique not always covered in other Swing books - event handling and the JFC root JComponent class.

Many of the subsequent chapters are self-explanatory. Chapter 4 covers "Labels and Icons". Chapter 5 is focussed on "Buttons". Chapter 6, "Bounded Range Components", looks at the BounderRangeModel and JScrollBar, JSlider and JProgressBar components that use it. Chapter 7 looks at "Lists and Combo Boxes", including related models and renderers. Chapter 8, "Swing Containers", covers JPanel, JRootPane, JLayeredPane along with the JFrame, JWindow and JApplet classes. Chapter 9 stays focussed on "Internal Frames" and the Swing desktop. This chapter shows a few nifty tricks, like displaying a desktop background, tiling frames and implementing your own DesktopManager.

Chapter 10 tackles "Swing Dialogs", including the surprisingly flexible JOptionsPane. Chapter 11, "Specialty Panes and Layout Managers", gives the reader a good understanding of JSplitPane, JScrollPane and JTabbedPane, along with all the JFC-specific layout managers. Chapter 12, "Chooser Dialogs", takes a look at the JFileChooser and JColorChooser dialog components. Chapter 13 covers "Borders", chapter 14 looks at "Menus and Toolbars", and chapter 15 digs into "Tables". The coverage in chapter 15 is very comprehensive and extends into "Advanced Table Examples", the focus of chapter 16. Much of the information presented here is not available anywhere else, with database examples, paging demonstrations and a nice look at all supporting classes, rather than just the high-level interfaces presented in other books. The "Tree" components gets its own chapter 17, with the "Undo" facility tackled in chapter 18.

The next several chapters are dedicated to the Swing text components. Chapters 19 to 24 cover "Text 101", "Document Model and Events", "Styled Documents and JTextPane", "Carets, Highlighters, and Keymaps", "Text Views", and "EditorKits and TextActions". That’s more than 250 pages with more in-depth text component coverage than you will find anywhere else. The coverage is, in fact, so comprehensive that you’ll be able to create your own custom document managers, or customize virtually any aspect of the text components available in the JFC. Chapter 25 covers the Accessibility API. Chapter 27 is especially interesting, providing great insights into using the Swing utility classes. The book wraps up with chapter 28, "Swing Under the Hood", which covers focus management, multithreading and painting issues.

If you’re developing Swing applications, you need this book. If you want to dig deeply into the Swing text components, this book is incomparable. If you want a deeper understading of the various models, renderers, editors, simple and advanced components in Swing, this book delivers what you need. Components like JTable, JTree and the text components provide incredibly powerful tools for developing sophisticated modern applications, but they can be complicated to learn. You’ll find the coverage in "Java Swing" effective and easy to read. Finally, the information provided on Swing utility classes, the look-and-feel API, accessibility and the undo interface is typically hard to find. If you work with Swing, this is a great investment.