Chapter 27. Swing Utilities


There are many tasks you run into that are common and not terribly difficult. Hence, they get rewritten several times in several small variations. Ideally, you would code the task up into a method or class, and keep it around for reuse later. There are several small classes and methods strewn about the javax.swing package that fall into this category. This chapter presents those bits and pieces and points out where you might be able to put them to use in your own code. They may not be as fundamental as the wheel, but anytime you don't have to rewrite something, you're doing your part to create better OO programs!

We've called this chapter "Swing Utilities," but in fact it covers a range of subjects. In order of presentation, we'll look at:

Swing utilities

The SwingUtilities class and SwingConstants interface

Timers

The Timer class

Tooltips

The TooltipManager and JToolTip classes

Rendering

The CellRendererPane, Renderer, and GrayFilter classes

Events

The EventListenerList, KeyStroke, MouseInputAdapter, and SwingPropertyChangeSupport classes

Figure 27-1 shows the classes covered in this chapter.

Figure 27-1. Class diagram for the utility classes
figs/swng2.2701.gif


Java Swing
Graphic Java 2: Mastering the Jfc, By Geary, 3Rd Edition, Volume 2: Swing
ISBN: 0130796670
EAN: 2147483647
Year: 2001
Pages: 289
Authors: David Geary

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net