Graphic Java: Mastering the AWT

Graphic Java: Mastering the AWT

by David M. Geary, Alan McClellan
     
 

View All Available Formats & Editions

"While almost every Java book covers the AWT, none . . . does it so well or provides such good advice on how best to use it." Dr. Dobbs Journal, March 1997

A comprehensive guide to the Abstract Window Toolkit for JDK 1.1.

Graphic Java 1.1 (Second Edition) has been completely revised to cover all of the AWT features provided by

Overview

"While almost every Java book covers the AWT, none . . . does it so well or provides such good advice on how best to use it." Dr. Dobbs Journal, March 1997

A comprehensive guide to the Abstract Window Toolkit for JDK 1.1.

Graphic Java 1.1 (Second Edition) has been completely revised to cover all of the AWT features provided by the 1.1 JDK. It provides detailed descriptions of every aspect of the AWT, including:

  • Lightweight components.
  • Graphics Colors and Fonts.
  • Event Handling.
  • Image Manipulation Clipboard and data transfer.
  • Menus.
  • Printing.
  • Dialogs.
  • AWT Layout Managers.

In addition, Graphic Java 1.1 comes with the Graphic Java Toolkit (GJT)—a set of freely reusable Java packages that extend the functionality of the AWT. The GJT provides over 40 high-level components, ranging from image buttons and scrollers to toolbars and convenience dialogs.

The accompanying CD-ROM includes all of the example code from the book, ready to run on Solaris, Windows 95 and Windows NT along with the JDK 1.1 for those platforms. The complete source code for the GJT for Solaris, Windows 95/NT, and Macintosh is also included for JDK 1.0.2 and JDK 1.1.

Product Details

ISBN-13:
9780135658475
Publisher:
Prentice Hall Professional Technical Reference
Publication date:
07/30/1996
Series:
Java Series
Edition description:
Older Edition
Pages:
600
Product dimensions:
7.05(w) x 9.25(h) x 1.80(d)

Read an Excerpt

PREFACE: Programmers working with Java typically don't have to write very much code before they're knee deep in the Abstract Window Toolkit (AWT). And when they're knee deep, they may start to look around for a helping hand.

In general, the goal of Graphic Java is to provide that helping hand.

The way we do that is twofold:
We describe practical use of the AWT, highlighting features, benefits, and gotchas and unraveling its mysteries as we go along.

We describe extending the AWT, focussing on a set of high-level custom components we've developed and packaged as the Graphic Java Toolkit.

We'd like to emphasize use of the Graphic Java Toolkit. In many ways, Graphic Java is not just a book with an accompanying CD. It is a product with an accompanying book. The Graphic Java Toolkit is a fully developed, fully tested, and fully documented product, and we think you'll find it well worth your while to crack the seal on the book's CD and put that toolkit to use. You'll notice that these aren't trinket programs to illustrate a point. They are thoughtfully conceived for real-world utility.

As our subitle suggests, we aim to help you master the AWT. To do that, we divide our book into two parts: exploring the AWT and extending the AWT.

Exploring the AWT
First, in Part 1 of Graphic Java, we describe the basics of using the AWT. We'll cover the range of standard classes provided by the AWT and show them in use. This includes:
Manipulating graphics, colors, and fonts
Managing events
Positioning components in the display
Manipulating images
Creating menus

To illustrate the AWT inaction, we'll draw on several custom components from Graphic Java Toolkit (GJT). Extending the AWT

Second, in Part 2 of the book, we present the Graphic Java Toolkit. In all, there are over thirty of these custom components. Among these are components such as:
Image buttons and toolbars
Separators and bargauges
Etched and three-dimensional rectangles and borders
Image and component scrollers
Rubberbands
Convenience dialogs

The GJT also includes image filters and a package of classes that developing sprite animations. You are welcome to use and incorporate into your own program development.

In describing these custom components, we highlight lessons learned and reveal tricks of the trade for those who'll be developing their own custom components. Along the way, we hope to encourage good programming practices, using Java's object-oriented features to develop elegant, maintainable, and readable code. And we try to do these things in practical terms, so that you can see and learn from examples of real programs.

Audience
This book is written for object-oriented programmers working with Java. There are numerous books explaining details of the Java language and how it works vis-a-vis Visual Basic, C, C++, et al. We leave details of how Java works to those books. If your new to Java, as most people are, you might want one of those books alongside Graphic Java.

The Graphic Java Toolkit
The CD that accompanies this book includes:
All the source code for the Graphic Java Toolkit.

Unit test applets for all GJT components, including HTML files for unit test applets.
HTML documentation for all GJT classes
Numerous image files in .gif format developed by Pixelsight

Virtually all these programs are discussed throughout the book. Feel free to borrow, adapt, or extend these for your own purposes.

The Graphic Java CD Directory Structure
Figure 11P-1 shows the directory structure on the CD.
The Graphic Java Toolkit Package Structure
Table 11P-1 shows the GJT package structure.
Table 11P-1 GJT Package Structure
Package
Contents
gjt
This package contains the source files for many of the custom components discussed in Graphic Java.

gjt.animation
This package contains a set of classes that support sprite animation.

gjt.image
This package contains a set of classes that provide support for image manipulation such as bleaching or dissolving images.

gjt.test
This package contains source code for all the component unit tests discussed in Graphic Java.

gjt.rubberband
This package contains a set of classes that support rubberbanding-stretching lines and shapes over a backdrop without affecting the backdrop.

Internet Sources of Information
There are several online sources of information on Java. You can find online guides and tutorials on Sun's home page: ...

Meet the Author

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >