- Series: Sun Microsystems Press Java Series
- Paperback: 878 pages
- Publisher: Prentice Hall Ptr; 1st edition (September 21, 1998)
- Language: English
- ISBN-10: 0130796662
- ISBN-13: 978-0130796660
- Product Dimensions: 7.2 x 1.8 x 9.5 inches
- Shipping Weight: 2.9 pounds (View shipping rates and policies)
- Average Customer Review: 11 customer reviews
- Amazon Best Sellers Rank: #2,897,820 in Books (See Top 100 in Books)
Enter your mobile number or email address below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.
To get the free app, enter your mobile phone number.
Graphic Java 1.2, Volume 1: AWT, Third Edition 1st Edition
Use the Amazon App to scan ISBNs and compare prices.
Java developers know that the Abstract Windowing Toolkit (AWT) is still an effective way to build functional user interfaces, whether inside Web browsers or in stand-alone applications. David Geary's guide to AWT programming in Graphic Java 1.2 shows you all the basics of AWT newly refitted for the new Java Developer's Kit (JDK) 1.2 standard from Sun, including some excellent 2-D animation examples.
After introducing the basics of the AWT library, the author looks at simple painting and 2-D graphics. Standout sections here look at displaying images--a staple of Internet programming--as well as transforming images with "filters" (such as dimming and rescaling an image). Graphic Java 1.2 shows you a variety of advanced techniques for getting control of your bit-mapped content. The tour of Java graphics capabilities moves on with coverage of layout managers and basic AWT components such as buttons, text fields, lists, and choices. For those who want to create stand-alone Java applications, there's much material on using Java menus.
The book's advanced material highlights new features of JDK 1.2, such as its support for lightweight controls, built-in double-buffering support, and advanced "native-style" operations (such as clipboard support and "rubber-banding" classes). The author also shows off his custom classes for 2-D sprite animation. --Richard Dragan
From the Author
Do You Need This Book If You're Using Swing?
If you're developing graphical user interfaces in Java, you are most likely using either AWT or Swing components. Obviously, if you're using AWT components, you'll want to consider this book. But what if you are using Swing?
A common misconception about Swing is that it is a replacement for the AWT. In actuality, although Swing components are replacements for the AWT components, Swing is built on the AWT. All Swing lightweight components are derived from the JComponent class, which in turn is derived from the AWT's Container class. So all Swing components are in fact AWT components.
Because Swing is built on the AWT, Swing developers need to have a basic grasp of AWT concepts. For example, Swing components use the delegation event model and are laid out by layout managers, both of which are implemented in the AWT.
In addition to covering fundamental AWT concepts, such as the delegation event model and layout managers, this book also discusses additional AWT topics such as: the Component class, graphics, colors and fonts, and image manipulation. Advanced topics, including data transfer and drag and drop, double buffering, rubber banding, and sprite animation are also discussed.
So, back to the original question: If you are using Swing, do you need this book? The answer is it depends on whether you have a basic understanding of fundamental AWT concepts, and whether you have need of advanced AWT topics. Also, the second volume of Graphic Java covers Swing exclusively; it does not discuss the AWT topics presented in this book. If you have the Swing volume of Graphic Java, and you need a better understanding of the AWT, this book is the perfect companion to the Swing volume. It should also be noted that only 150 pages of the AWT volume (out of 875 pages) are concerned with AWT components; more than 80% of this book is devoted to fundamental and advanced AWT concepts.
If you are new to building user interfaces in Java and are serious about Swing programming, you should consider both volumes of Graphic Java, which together provide more than 2500 pages of the most comprehensive coverage available on Swing and the AWT. If you're using Swing and are already familiar with the AWT, you can skip this volume and move on to the Swing volume of Graphic Java.
A Closer Look at Some of the Topics Covered in This Book:
The AWT Component Class:
A chapter is dedicated to the superclass of all AWT and Swing components: the Component class. Component properties are explored in addition to setting minimum, maximum, and preferred component sizes. Setting cursors for components, and the implementation of custom cursors are also discussed. The chapter concludes with discussions of component serialization and internationalization in addition to the relationship between components and JavaBeans.
Delegation Event Model:
The delegation event model is discussed in great detail in a chapter that is nearly 100 pages long. The chapter begins with an overview of event sources, event listeners and the event classes themselves. The two types of AWT events -- component and semantic -- are discussed in addition to event adapters and the use of inner classes for event handling. Next, custom events are explored, in addition to manually dispatching events to a component using the AWT event queue. The chapter concludes with a look at active events (new for the 1.2 JDK), the delegation event model's inheritance-based mechanism and a discussion on event handling design.
More than 100 pages are dedicated to layout managers. All of the standard AWT layout managers are discussed in detail, including nearly 30 pages devoted to the AWT's most powerful -- and most confusing -- layout manager, GridBagLayout. Other topics include forcing a container to layout its components, laying out components without using a layout manager, implementing custom layout managers, and using GridBagLayout with input forms.
Graphics, Colors, and Fonts:
Two chapters illustrate graphical operations and the use of colors and fonts. A discussion of the Graphics class includes a discussion of the component coordinate system, and when it is appropriate to copy and dispose of Graphics instances. Basic painting operations, such as painting and filling shapes are also discussed. The colors and fonts chapter provides an overview of color models, system colors, and fonts and font metrics.
Image Manipulation and Animation:
Three chapters are devoted to image manipulation. A chapter on loading and displaying images clearly presents the often confusing topic of image producers and image observers, in addition to using the MediaTracker class to asynchronously load images. The differences between using images in applets and applications is also explored, in addition to using animated GIFs and loading images as resources. The second chapter discusses image filtering in detail by presenting the implementation of a number of custom image filters. One of the most difficult aspects of image filtering, extending the ImageFilter class, is discussed in detail. The chapter concludes with sections on implementing the ImageConsumer interface and an introduction to double buffering. The third chapter discusses image manipulation without filtering by scaling and flipping images, and using the PixelGrabber and MemoryImageSource classes.
The final chapter in the book presents a custom animation package, which clearly illustrates the steps involved in implementing sprite animation. You will find this chapter useful if you need to develop animations that go beyond merely flipping through a stack of images.
Data Transfer and Drag And Drop:
Two chapters cover data transfer and drag and drop. The data transfer chapter illustrates copying data to, and retrieving data from, both local clipboards and the native clipboard. The rest of the chapter is concerned with the AWT's data transfer mechanism. The AWT only provides built-in support for transfering strings, so the chapter concludes with examples that illustrate how to transfer images and AWT components. The drag and drop chapter provides an overview of the java.awt.dnd package, and includes a simple recipe for implementing drag and drop. The chapter also discusses the differences between using inheritance vs. delegation when implementing drag and drop, and a section on the use of Java reflection to implement more general drag sources and drop targets.
Showing 1-8 of 11 reviews
There was a problem filtering reviews right now. Please try again later.
E.g. Layout Manager, Painting. Since Swing is based on AWT and not a replacement for AWT. Even though this a very old edition and nobody uses AWT components directly, it is necessary.
Although it is perfectly feasible to get by in Java using just the information available in the Core Java series, there is a wealth of extra knowledge avaible in this book regarding the AWT. I've found that the extra information on Layout Managers alone has made the book worth its price for me. If your interest is in development or maintenance of AWT components then I'd recommend this as an essential reference book.
The only thing (admittedly minor) I could critisize about the book is the use of Booch notation rather than UML. It shows that the book is overdue for a second edition.
Apparently an improved version of the inheritance model came as a sideshow with the delegation model. Though the new inheritance model is an improvement over the old one, the docs discourage its use.