Java Reference
In-Depth Information
In Chapter 11 we discuss techniques for monitoring the image loading and to
signal when the loading has finished. Here we just note the ImageObserver
parameter. The image loading machinery uses this reference to call back via
the imageUpdate() method of the ImageObserver interface. The callbacks
occur periodically during the loading and provide information about the status of
the loading. The Component class implements the ImageObserver interface
and overrides the imageUpdate() method. So you commonly see the following
type of invocation of drawImage() where this references the component
on which the image is to be drawn:
drawImage (img, int x, int y, this);
6.10 Java and tech graphics
Programs for engineering and science applications frequently employ graphics
for tasks such as:
Charting , such as in a histogram, pie chart, or other arrangement that displays data in
some informative manner
Plotting functions, such as the trajectory of a ballistic projectile in altitude versus
horizontal distance
Animating a simulation of some device or physical process (see Chapter 8)
Image processing to bring out features of interest (see Chapter 11)
Agraphical display program would also typically include various control and
data entry components to provide a user interface to allow the user to interact
with the presentation. As we have seen in this chapter, Java provides lots of tools
and components for building such graphical displays and user interfaces.
Of course, many other programs also provide for data display and manipula-
tions. Why use Java for this purpose? With Java you can build custom graphical
programs for tasks where you can integrate all of the Java features together. For
example, an application program to control and monitor a remote experiment
via the Web could use both the graphical capabilities of Java and the networking
capabilities of Java (see Part II). We see in Chapter 8 that you can use the easy
thread-processing capabilities of Java to create animations for demonstrations
and simulations.
Note that you can now obtain libraries, both commercial and freeware, that
provide Java classes and visible components for charting, image processing, and
other graphics-related tasks. However, you will still find it useful to know how to
write your own graphics classes for customized purposes.
6.11 Histogram graphics
In the Web Course Chapter 6: Te ch section, we demonstrate Java graphics with
the PlotPanel and HistPanel classes. PlotPanel is an abstract class that
Search WWH ::




Custom Search