Once loaded into Java, images, whether GIF or JPEG, become instances of
the abstract java.awt.Image
class.
The Image
class has these eight methods:
public Image()
public abstract int getWidth(ImageObserver observer)
public abstract int getHeight(ImageObserver observer)
public abstract ImageProducer getSource()
public abstract Graphics getGraphics()
public abstract Object getProperty(String name, ImageObserver observer)
public Image getScaledInstance(int width, int height, int hints)
public abstract void flush()
However, most of the work with images takes place in other classes,
particularly java.awt.Graphics
, java.awt.Component
, and java.awt.Toolkit
. You pass to an Image
object to methods in these classes to load and display the image.