Package java.awt Previous
Previous
Java API
Java API
Index
Index
Next
Next

Class Image

Fields , Constructors , Methods

public  abstract  class  java.awt.Image
    extends  java.lang.Object  
{
        // Fields
    public final static Object UndefinedProperty;	

        // Constructors
    public Image();	

        // Methods
    public abstract void flush();	
    public abstract Graphics getGraphics();	
    public abstract int getHeight(ImageObserver  observer);	
    public abstract Object	
        getProperty(String  name, ImageObserver  observer);
    public abstract ImageProducer getSource();	
    public abstract int getWidth(ImageObserver  observer)	

}

The abstract class Image is the superclass of all classes that represent graphical images.


Fields


UndefinedProperty

public final static Object UndefinedProperty 
        = new Object() 

The UndefinedProperty object should be returned whenever a property which was not defined for a particular image is fetched.


Constructors


Image

public Image() 

The default constructor for an image.


Methods


flush

public abstract void flush() 

Flushes all resources being used by this Image object.

These resources includes any pixel data that is being cached for rendering to the screen as well as any system resources that are being used to store data or pixels for the image.

The Image object is reset to a state similar to when it was first created so that if it is again rendered, the image data must be recreated or fetched again from its source.


getGraphics

public abstract Graphics getGraphics() 

Creates a graphics context for drawing to an off-screen image. This method can only be called for off-screen images, which are created with the createImage method with two integer arguments

Return Value:

Returns a graphics context to draw to the off-screen image.


getHeight

public abstract int getHeight(ImageObserver  observer) 

Determines the height of this image. If the height is not yet known, the observer is notified later.

Return Value:

Returns the height of the image, or -1 if the height is not yet known.

ParameterDescription
observer an object waiting for the image to be loaded

See Also: getWidth ImageObserver .


getProperty

public abstract Object
getProperty(String  name, ImageObserver  observer) 

Gets a property of this image by name.

Individual property names are defined by the various image formats. If a property is not defined for a particular image, this method returns the UndefinedProperty object.

If the properties for this image are not yet known, this method returns null and the ImageObserver object is notified later.

The property name "comment" should be used to store an optional comment which can be presented to the application as a description of the image, its source, or its author.

Return Value:

Returns the value of the named property.

ParameterDescription
name a property name
observer an object waiting for this image to be loaded

See Also: ImageObserver UndefinedProperty .


getSource

public abstract ImageProducer getSource() 

Return Value:

Returns the image producer that produces the pixels for this image.


getWidth

public abstract int getWidth(ImageObserver  observer) 

Determines the width of this image. If the width is not yet known, the observer is notified later.

Return Value:

Returns the width of this image, or -1 if the width is not yet known.

ParameterDescription
observer an object waiting for the image to be loaded

See Also: getHeight ImageObserver .



Top© 1996 Sun Microsystems, Inc. All rights reserved.