ACCU Home page ACCU Conference Page
Search Contact us ACCU at Flickr ACCU at GitHib ACCU at Facebook ACCU at Linked-in ACCU at Twitter Skip Navigation

Search in Book Reviews

The ACCU passes on review copies of computer books to its members for them to review. The result is a large, high quality collection of book reviews by programmers, for programmers. Currently there are 1949 reviews in the database and more every month.
Search is a simple string search in either book title or book author. The full text search is a search of the text of the review.
    View all alphabetically
Title:
Swing
Author:
Matthew Robinson&Pavel Vorobiev
ISBN:
1 884777 84 8
Publisher:
Manning
Pages:
917
Price:
£44-99
Reviewer:
Peter Pilgrim
Subject:
java
Appeared in:
12-3
Swingis a book about programming with Java Foundation Classes user interface components. Swing is the code-name for complex cross-platform next generation user interface for the Java platform. Robinson's and Vorobiev's book does not attempt to teach you the basics. It is not an introductory text, but is aimed at developers who would like to develop more professional looking applications. On first impression the book is masterful in its presentation. Although 918 pages long there is much source code and you can plainly see the attention to detail the authors have attempted. The source code is laid out clearly with the type falling into the margin and font size is point on. There are no comments. Any new code is emboldened. The code is however comprehensively labelled and enumerated. The level of the code is generally just below production rollout standard. Compared to other books this content style is a winner and the authors are to be congratulated as they are clearly responsible for making the publishers settle on this annotation style.Swingcontinues where Manning's ownUp To Speedand O'Reilly'sJava Swingstops. Throughout the book there are helpful bugs to avoid and developer notes. The authors enlisted the help of David Anderson, a usability and interface design export, to provide a generous supply of user interface notes.

The book is divided into four parts across 24 chapters: the foundation, the basics, the advanced topics and finally special topics.

Readers are treated to the model view controller overview and UI foundations in the first two chapters. This is fair enough except for several in-depth treats on topics such as multithreading, timers, JavaBeans and common graphics operations. You will find handy advice for painting and validation, focus management, keyboard input and those ubiquitous actions. This covers your foundation.

The basics, part II, focuses on each Swing component, from frames, panels and borders; to layout managers; to tabbed panes; to combo boxes; to progress bars, sliders, text components and dialogues. The basics covers around 300 pages and 11 chapters. Okay, you may already know to add an ImageIcon to a button and align the text label such that looks exactly like the reload button in a popular web browser, but did you know that is easy to create a disabled image for it with just one line of code. The book demonstrates how the button can use HTML text to render multi-lined tool-tips, labels and buttons. The authors reveal code for very nice transparent custom buttons that can be used as image map in a web applet. Often UI designers want to produce a simple text entry form. For example to add a front end to a help desk support application or customer order processing database. It is infuriating to get the correct layout of label and text field using the standard Swing API libraries. The authors provide a very handy custom dialogue layout manager that effortlessly handles such forms. When to use dialogue is a theme that many UI developers get wrong. Good advice is given on when to include these fundamental choice components. Often developers are faced with the general file chooser and just use the bog standard default attributes. One benefit of the book is the good description of file filter classes and file accessory view classes.

The authors cleverly provide a running theme: the development of a basic text editor. The example is introduced in chapter 12; menus, toolbars and actions. The first construction, of course, uses a menu bar and several pull downs and menu items. Threads are used to open and save text files to and from the editor. Code is structured and easy to understand. The text editor is steadily improved upon by adding a toolbar, which reuses the same actions, created in the first example. By the way there is a great illustration showing how a toolbar is undocked to a floating component and back to the docked component again. The third example adds custom toolbar components and more treats. If you ever wanted to find out how to program those funky rollover buttons, then look here. The fourth example demonstrates how Swing can be applied to build professional UI. A custom colour panel of the sort that appears in top vector based drawing packages is added to the basic editor application. The custom colour panel menu item allows an operator to select a predefined colour from a grid of small colour panes. All of this in an extra 60-70 lines of code. The quality of the book could be established just sampling chapter 12. Part II is so good there just is not enough space to cover everything. Rest assured there are lots of upper intermediate type applications of

JSliders, 
JTabbedPanes, JProgressBars
and
JTextPanes
. There is even a fully working FTP client included.

Part III moves onto more advanced UI topics, starting from multiple document interfaces and internal frames through tree and table components to customising Swing's pluggable look and feel architecture. Readers will be amazed by the complete reworking of a custom MDI component from a simple inner frame to very complex piece of software. After browsing chapter 15 you will appreciate the work of art in the standard Swing

JInternalPane
. With the
JInternalPane
itself there are advanced examples of its use. There is a complete implementation of a panorama virtual window viewer application and network enabled chat server and client. The chapter on the tree component shows you how to implement a simplistic version of the Windows Explorer left hand pane, which is the hierarchical file and directory viewer. The authors use the
JTree
component with pop up menu and programmatic navigation. Moreover, you will learn how to add and remove tree nodes dynamically, because there simply isn't enough space or time to traverse your hard-disc in real-time every time you want to explore your C: drive. To finish off the
JTree
component there is an advanced XML document navigator using Sun's early access XML library. Chapter 18 has the authors discussing the table component. You will learn how to program data models, custom cell renderers and editors and specialised data formatters. As well as providing know-how about sorting table columns, it helps to be able to use the
JTable
component to read and write databases. Unfortunately the example in the book relies on the user having Microsoft Access and naturally a JDBC-ODBC bridge driver, but the programming technique is sound. You can modify the code to make it work with other databases, but the actual data cannot be easily transferred. For me the piece de resistance is the Java Beans property editor, the last example in the chapter. Start building your own IDE.

The following two chapters, 18 and 19, provide a deeper insight into the Swing text components. Although they are basically easy to use, these are the most difficult components to understand, enhance and customise. Whereas O'Reilly's Java Swing provides thorough textual description of the inner workings of the Swing development team's design. Robinson and Vorobiev exhibit the expose. Beginning with a date/time editor and ending with functional spell-checking word processor application. Some 124 pages are devoted to text components, styled documents, style attributes, carets, highlighters and view factories. Practical and sought after discussion and code.

The remaining chapters of the book are pluggable look and feel, printing and a brief compact overview of the Java 2D API. These are the special topic of part IV. Four more chapters are available on line, namely: Accessibility, Java Help API, CORBA and extra contributions. Due to space limitations they are not included, with some 915 pages, I agree wholeheartedly, we need to conserve the environment. They are free to all readers on the book's website, where you can also download the source code for the entire book.

UI development is a very time consuming business. Even with such a powerful next generation API at your fingertips it can be still overwhelming. Swing is a wonderful book that lightens the burden. It presents a complex subject in smaller manageable portions for the programmer who has learnt the basics and wants to go much further. This excellent book is impossible to take in at the first reading, because of the scope and breadth of its subject matter. I think you will find that it hits and hits its target audience and goals repeatedly. A massive quality and quantity win for the publisher, Manning.