images
An image is a file that
represents an image using some standard grapichical image file format (such as GIF and
JPEG). Java's Graphics class can draw bitmapped images in such file
formats.
images (from any source) are objects of class image.
The retrieval of an image may take some time (e.g. from a distance web site), so it is
carried out in the background.
The technicalities of retrieving and displaying an image
are quite complex (involving about six different classes) but this is mostly hidden from
the programmer.
The method 'drawimage()' in the Graphics class draws an object of class image on the screen.
There are a variety of techniques for getting an image object
that represents a specific image file. In a Java applet, the simplest technique is
probably to use the getimage() method
in the Applet class. So displaying an image from a GIF file could be as simple as this (in
an applet):
image image =
getimage("test.gif");
g.drawimage(image, 0, 0, this);
Note that
getimage() can retrieve images from a remote computer using a URL.
Back to top

RITSEC - Global Campus
Copyright ?1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg
|