Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:

It don't mean a thing if it ain't got that Swing: A comparative review of four JFC/Swing books

The first wave of JFC/Swing books has hit the shores. Find out which -- if any -- of these four books delivers the goods on this complex and integral part of the JDK

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Ignore JavaBeans, JDBC, RMI, Servlets, Java3D, Java's Security API, and so on, ad infinitum. Java's most important API is its sizzling Java Foundation Classes API, prominently featuring the Abstract Windowing Toolkit (AWT)'s long-awaited successor: the Swing GUI class library.

Why does JFC, and more specifically Swing, overshadow all other Java APIs? Because 99.9 percent of modern applications require rich GUI front ends. Whatever application domain you specialize in, we all need to clothe our applications in modern graphical user interfaces. This GUI facade doesn't only make or break modern applications, it also severely impacts your software development efforts. Huge chunks of your (and my) code are there purely and simply for the sake of user friendliness, and have nothing to do with core product functionality. GUIs are really the software equivalent of automatic transmissions, vanity mirrors, central locking, and adjustable seats in cars. That is, the essential non-essentials without which you don't sell products.

GUI capability was the sole reason for the often-criticized AWT's original raison d'etre. Unfortunately, AWT's multitude of flaws and imperfections have led many to feel that Java's original GUI capability is just another Java Achilles heel (performance being the first). Thankfully, JavaSoft seems quite adept at quickly and skillfully addressing Java aspects that fall below expectations (possibly excluding politically too-hot-to-handle issues like its unpopular Collections API), so we now have Java Foundation Classes (JFC) to relegate AWT to the history books.

If you're a regular visitor to Sun's Java Developer Connection (JDC) discussion groups, you know that the volume of GUI questions is at least an order of magnitude greater than for some other "hot" Java APIs. In light of this, I decided it was time JavaWorld took a closer look at books that aim to flatten the JFC/Swing learning curve, and bulldoze AWT from the Java map in the process. This month I'm reviewing four quick-off-the-mark JFC books (and, as always, taking my dope-test kit along.)

At the time of writing, four books were available that include the words Java Foundation Classes, JFC, or Swing in their titles:

  • Java Foundation Classes by Matthew T. Nelson (McGraw-Hill)
  • JFC: Java Foundation Classes by Daniel I. Joshi and Pavel A. Vorobiev (IDG Books)
  • Programming with JFC by Scott R. Weiner and Stephen Asbury (John Wiley)
  • Up to Speed with Swing: User Interfaces with Java Foundation Classes by Steven Gutz (Manning)


Note: Core Java Foundation Classes by Kim Topley, Cay S. Horstmann, and Gary Cornell (ISBN: 0130803014) was not available for review at press time.

Here's a bird's-eye view of each title's main attributes. The table orders the books by price.



Up to Speed with Swing (Manning) JFC: Java Foundation Classes (IDG Books) Java Foundation Classes (McGraw-Hill) Programming with JFC (John Wiley)


Price (US$) 2.95 9.99 9.95 9.99
Pages, chapters (appendices) 498, 13 (4) 541, 11 (3) 1040, 13 (0) 560, 19 (2)
Index Average Good Good Average
Glossary No No No No
CD-ROM No Yes Yes Yes
Authors 1 2 1 2
Listings density (lines/page) 48 44 54 45
MVC framework Yes Yes No No
Pluggable look-and-feel framework Yes No Yes Yes
Document framework Yes No Yes Yes
Undo/redo framework No Yes No Yes
Drag-and-drop framework No Yes Yes No
Printing framework No Yes Yes (*) No
Accessibility framework No Yes Yes Yes (*)
Java2D No Yes (*) Yes No
No. of "real-life" examples None 4 4 2
Overall score 7 7 6 7


*Strictly speaking, yes, but only touched upon.

In the absence of tools to calculate the true cost-per-bit equivalent of a book, the Listings density row gives you an idea of how dense or "aerated" the source listings are. Low lines and/or page values usually mean unreadable listings and a high page-fill factor, so the higher this value, the better (up to some limit determined by your own eyesight, of course).

The MVC framework row indicates whether or not the text explains Swing's underlying Model-View-Controller design pattern.

The Pluggable look-and-feel framework row indicates whether or not the text explains and demonstrates Swing's pluggable look and feel (PLAF).

The Document framework row indicates whether or not the text attacks the nontrivial subject of Swing's Text Document framework (that is, package com.sun.java.swing.text and its subpackages).

The Accessibility framework row indicates whether or not the text explains Swing's accessibility support for people with disabilities.

The Drag-and-drop framework row indicates whether or not the text discusses JFC's drag-and-drop support, as provided by the classes and interfaces in the java.awt.dnd package.

The Undo/redo framework row indicates whether or not the text discusses JFC's undo/redo support as provided by the classes and interfaces in the com.sun.java.swing.undo package.

The Java2D row indicates whether or not the text explores JFC's Java2D API. Most texts don't, since Java2D is most definitely a subject worthy of its own book(s). Any JFC books reviewed here that do write about Java2D do so only superficially.

The No. of "real-life" examples row indicates how many mini-projects are presented that begin to approach a real-life project.

Up to Speed with Swing: User Interfaces with Java Foundation Classes by Steven Gutz (Manning)

While the first part of this book's title is spot-on accurate, the second part isn't. Up to Speed with Swing is all about Swing's GUI component classes, and very little, if at all, about any of the other JFC APIs (see comparative table). Despite this little titling error (which publishers seem to make more and more often, and which always seems to broaden the scope of a book), the book's content does deliver on its title's core promise.

The book is subdivided into three parts: Part I, "Getting started;" Part II, "Swing components;" and Part III, "Advanced topics." Chapter 1, "A Java refresher," is really an AWT (and not Java) refresher that concentrates on event handling and layout managers, two aspects that have remained unchanged from AWT to Swing. Chapter 2, "Swing basics," therefore, is the beginning of the real meat on this particular bone. After an overview of the Swing packages, the author delves into the Model-View-Controller (MVC) design pattern, the architectural foundation for everything Swing -- especially its pluggable look and feel, custom rendering, and custom model capabilities. The chapter closes with a thorough "open-top bus tour" of class JComponent, the abstract grandaddy of all Swing GUI components.

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comment
Login
Forgot your account info?
Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.
Resources
  • Swing comes with its own "Swing Connection" newsletter. http://java.sun.com/products/jfc/tsc
  • JavaSoft's ever-growing Java Tutorial also keeps track of Swing developments in "Using the JFC/Swing Packages." http://java.sun.com/docs/books/tutorial/ui/swing/index.html
  • The JDC Online Training feature provides two Swing courses. http://developer.javasoft.com/developer/onlineTraining/
  • Other JFC/Swing books unavailable for review:
  • Core Java Foundation Classes by Kim Topley, Gary Cornell, and Cay S. Horstmann
  • JFC 1.1 mit Swing 1.0 by André Meyer (German)
  • Read Laurence's other great book reviews. http://www.javaworld.com/common/jw-ti-bookreviews.html
  • Check out the JavaWorld Bookstore, which showcases books recommended for Java developers and allows you purchase hundreds of other Java books. http://www.javaworld.com/books/jw-clbooks.html
  • Can't find a particular title in the JavaWorld Bookstore? The JavaWorld Book Catalog provides an exhaustive listing of every book in the field, including foreign-language and out-of-print titles. http://www.javaworld.com/books/jw-books-index.html