Manning Logo
Home | Ordering Info | Shopping Cart | Manage My Account | Login
Attention customers: online shopping is now available exclusively through our main website: http://www.manning.com. Thank you.
Swing Second Edition

Inside the book

Sample Chapters Table of Contents Foreword Index Preface Book Reviews Source Code The Story of Swing Author Online

Manning Blog

Why small is sweet?

Author Blogs

Dave Crane more...

Author Calendar

Upcoming Events

Catalog

Java .NET Perl XML All by Subject All by Title

About...

Manning Contact Us Ordering FAQs ebooks Covers Sandbox Forums Distributors Manning Early Access Program (MEAP) Affiliate Program Academia/Publicity User Group Program Press Releases Jobs

Manning Publications Co.
209 Bruce Park Avenue
Greenwich, CT 06830

Swing Second Edition
Foreword by James Gosling, "Father" of Java
Matthew Robinson and Pavel Vorobiev

2003 | 912 pages
ISBN: 193011088X
$25.00 PDF ebook  
$49.95 Softbound print book  

Preface

This book is best described as a programmer’s guide, serving both as a reference and a tutorial. Emphasis is placed on using Swing to solve a broad selection of realistic and creative problems. We assume an intermediate knowledge of Java, including the basics of putting together an AWT-based GUI, how the event model works, and familiarity with anonymous and explicit inner classes. Those who do not have this background can pick it up in any beginner book on AWT or Swing. However, the first edition of this book has proven to be most useful to those who come to it with an intermediate understanding of Swing. For this reason we do not recommend this book to Swing beginners. For beginners we suggest Manning’s own Up to Speed with Swing by Steven Gutz.

Our goal was to produce a book that contains enough explanation and examples to satisfy the most demanding Swing developer. We feel we have accomplished this goal again with the updates in this edition, but please judge for yourself and we welcome all constructive feedback. Unlike the first edition, however, this version is not freely available on the publisher’s web site. The first edition will remain available online at www.manning.com/sbe, but we hope that we have developed enough of a following to generate more sales with the second edition without giving it away for free. Let’s hope this is true!

What’s changed since the first edition?

Java 1.4 (aka Merlin) is the first major release of the Java platform that was planned through a Java Community Process (JCP), allowing participants outside of Sun to have an influence on the overall feature set. Each new feature, whether an addition or a change, had a dedicated expert group which handled the description of that functionality according to certain rules underlying Java Specification Requests (JSRs), which are the building blocks of any JCP. Similar to an open-source project, but with actual development still done by Sun engineers, this process allowed Java 1.4 to evolve for the first time in a democratic fashion. The result is a platform containing improvements that the Java community as a whole voted for, not just Sun.

This updated edition of Swing contains many new examples, revised text, and additional material to bring the book up to date with Java 1.4. This includes complete coverage of the new JSpinner and JFormattedTextField components, the new focus and keyboard architectures, scrollable tabbed panes, indeterminate progress bars, variable height JTable rows, and many other new features. Larger changes to the book include the addition of three new chapters: “Constructing an HTML Editor Applications,” “Constructing an XML Editor,” and “Drag and Drop” with Swing. A new appendix on Java Web Start has also been added and all examples throughout the book have been enhanced to conform to the Java look and feel design guidelines.

Organization

In general, each chapter starts with class and interface explanations occasionally interspersed with small examples to demonstrate key features. The bulk of each chapter is then devoted to the construction of several larger examples, often building on top of previous examples, illustrating more complex aspects of the components under investigation.

Part I contains two chapters that introduce Swing and discuss the most significant mechanisms underlying it. The first chapter is a brief overview that we suggest for all Swing newcomers. More experienced developers will want to read straight through most of chapter 2, as it provides an understanding of Swing’s most significant underlying behavior. This chapter is referenced throughout the book, and we expect all readers to refer to it often. At minimum we recommend that all readers skim this chapter to at least get a rough idea of what is covered.

Part II consists of twelve chapters covering all the basic Swing components with detailed descriptions and helpful examples of each. These chapters discuss the bread and butter of Swing-based GUIs, and each includes usage guidelines written by a usability and interface design expert.

Part III contains seven chapters dealing with the more advanced components. These chapters are significantly more complex than those in part II, and they require a thorough understanding of Swing's architecture, as well as the basic Swing components.

Part IV consists of three chapters on special topics with a focus on Swing, including printing, constructing an XML editor application, and implementing Drag and Drop.

Most examples are presented in three distinct parts:

The code: After a general introduction to the example, including one or more screenshots, the underlying code is listed. Annotations appear to the right of significant blocks of code to provide a brief summary of its purpose. Each annotation has a number which links it to the explanation of that code in the Understanding the code section.

Understanding the code: This section contains a detailed explanation of the code. Most paragraphs are accompanied by a number which links that text with the associated annotated code listed in the code section.

Running the code: After the code is explained, this brief section provides suggestions for testing the program. This section may also include references and suggestions for taking the example further.

Conventions

NOTE Throughout the book we point out specific behaviors or functionality that either differs from what is expected or that can be achieved through alternate techniques. We also use this icon to denote various other types of notes, such as a reference or suggested background knowledge for the material being discussed.

Java 1.3 We use this mark wherever a new feature or update is introduced from Java 1.3.

Java 1.4 We use this mark wherever a new feature or update is introduced from Java 1.4.

BUG ALERT Occasionally, incorrect or unexpected behavior is caused by known Swing bugs. We do not attempt to hide or gloss over these; rather, we explicitly discuss these bugs and explain possible workarounds or fixes where applicable.

David Anderson, a usability and interface design expert, has provided detailed usage guidelines throughout the book. These guidelines do not represent hard-and-fast rules, but they are highly recommended for the development of consistent, user-friendly interfaces (see appendix B for David's references and recommended UI design readings).

All source code appears in Courier font. For example:

public void main( String args[] ) {

Example myExample = new Example();

}

We prefix all instance variables with “m_,” and capitalize all static variables with underscores separating compound words. For example:

protected int m_index;

protected static int INSTANCE_COUNT;

Many examples are built from examples presented earlier in the book. In these cases we have minimized the amount of repeated code by replacing all unchanged code with references to the sections that contain that code. All new and modified code of any class is highlighted in bold. When a completely new class is added, we do not highlight that class in bold (the only exceptions to this rule are anonymous inner classes).

Author Online

Purchase of Swing Second Edition includes free access to a private Internet forum where you can make comments about the book, ask technical questions, and receive help from the authors and from other Swing users. To access the forum, point your web browser to www.manning.com/robinson2. There you will be able to subscribe to the forum. This site also provides information on how to access the forum once you are registered, what kind of help is available, and the rules of conduct on the forum.

Matt can be contacted directly at matt@mattrobinson.com.

Pavel can be contacted directly at pvorobiev@yahoo.com.

David Anderson, author of the UI Guidelines, can be contacted through www.uidesign.net.

Obtaining the source code

All source code for the examples presented in Swing Second Edition is available from www.manning.com/sbe.

DESCRIPTION

This book builds on the successful approach of the first edition of Swing, once again taking the power and flexibility of Java's Swing library to its limits. Using a fast-paced style, it starts by introducing each of the Swing components and continues with production-quality code examples in which Swing features are customized, combined, and vigorously exercised to demonstrate real-world usage.

With over 400 pages of revised text, additional examples, and new material to bring the book up to date with J2SE 1.4, Swing Second Edition includes complete coverage of the new JSpinner and JFormattedTextField components, the new Focus and Keyboard architectures, and many other new and enhanced Swing features. Three new chapters have also been added to cover the construction of HTML and XML editor applications, and how to work with the new Drag & Drop architecture.

What's Inside:

  • In-depth table, tree, text, MDI and L&F coverage
  • All about painting, multithreading, keyboard focus and input
  • Guidelines and techniques for good UI design
  • Using the new JSpinner and JFormattedTextField components
  • Scrollable tabbed panes and indeterminate progress bars
  • How to implement, among other things:
    • FTP and JPEG editor applications
    • A full featured MDI plain text editor application
    • JTable stock quote and expense report applications
    • A JavaBeans property editor application
    • A full featured HTML editor application
    • A JTree-based file system explorer application
    • Sorting and printing tables
    • A custom multi-page print preview component
    • An XML editor application
    • Drag & Drop

ABOUT THE AUTHORS...

Matt Robinson cofounder of Santa Clara-based Recruitforce.com, has four years’ experience as a Swing engineer working on enterprise software. He has written numerous contributions to Java books, magazines and academic publications.

Pavel Vorobiev, also a Recruitforce cofounder, has 16 years of software development experience at both small and large companies such as Iona, i2 Technologies and Merrill Lynch. He is the co-author of four earlier Java books.

Home | Catalog | Privacy Policy | About Manning

© 2003-2006 Manning Publications Co.