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
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.
Layout Managers:
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.
Product Details
Would you like to update product info or give feedback on images?
|
|
Share your thoughts with other customers:
|
||||||||||||||||||||||
|
Most Helpful Customer Reviews
24 of 24 people found the following review helpful:
4.0 out of 5 stars
The BEST book available on the AWT,
By A Customer
This review is from: Graphic Java 1.2, Volume 1: AWT, Third Edition (Paperback)
Unfortunately, unlike other Java topics like language fundamentals, I/O, or programmer certification, there are very few books which cover the AWT adequitely. This book is the exception. What makes this book really special is that it presents all the basic information you need to know about what components are available and how to use them. But it also teaches you two more things on the way: (a) fundamental graphics operations such as rubberbanding, double buffering, and sprite animation which you will need to know for any programming language (b) how design patterns figure prominently in the AWT API (don't know what design patterns are? check out the BIBLE by the 'gang of four':Design Patterns : Elements of Reusable Object-Oriented Software (Addison-Wesley Professional Computing) ) Here are some of the tidbits I found most helpful: *limitations associated with peers *overriding deprecated java 1.0 methods *prevent excessive flashing by overriding update *avoiding race conditions with modal dialogs *using font metrics and validate intelligently to force text to resize with components *using the built-in image filters in java.awt.image Some things with the AWT can drive you nuts because they don't work as advertised, and this book should include, but doesn't, a discussion of: *ScrollPane displays excessive flashing when scrollling images- even his example code- this is an AWT bug which should be mentioned *the toFront method does work reliably - another huge bug *using anonymous inner classes can make some of your windows unreachable by the GC and lead to memory leaks Anyway, I practically lived with this book for two months while working on a project and would have to say this is THE reference for the AWT.
7 of 8 people found the following review helpful:
5.0 out of 5 stars
I'm not through this book yet, but it so far it's amazing!,
By Justin Greenwood (jegreenw@iupui.edu) (Indianapolis) - See all my reviews
This review is from: Graphic Java 1.2, Volume 1: AWT, Third Edition (Paperback)
There is a sad sparsity of good Java books, especially when it comes to the AWT. I am really impressed with this book and I highly suggest it to anyone that really wants to learn the JFC APIs. It would be really nice if the JDK documentation had something like this, but they left the examples and explinations out so they can sell more Java books. Well, I guess Sun needs to make some money on Java somehow, right?
2 of 2 people found the following review helpful:
5.0 out of 5 stars
Draggable saints - it's come to this !,
This review is from: Graphic Java 1.2, Volume 1: AWT, Third Edition (Paperback)
Excellent and clearly written, but you better know the difference between "extends" and "implements" or forget it. I appreciated the six versions of the ThreeDButton listener in chapter 9, and now have a much clearer understanding of event handling.
Share your thoughts with other customers: Create your own review
|
|
Suggested Tags from Similar Products(What's this?)Be the first one to add a relevant tag (keyword that's strongly related to this product).
|
|
This product's forum
Active discussions in related forums
Search Customer Discussions
|
Related forums
|