All About Class Image in AWT in Java


Class Image in AWT in Java
Class Image in AWT in Java

Class Image in AWT in Java:

Please read this article on Image basics here.The abstract class Image is the superclass of all classes that represent graphical images.
With this class we can load an image object that obtains it pixel data from a specified URL.

The structure of the class is given as below:


public abstract class java.awt.Image extends java.lang.Object{
//member element:
public final static Object UndefinedProperty;
//The UndefinedProperty Object should be returned whenever a property which was defined for a particular
//image is fetched.
//constructor
public Image()//default constructor
//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);
}
 

Applet class has the following methods to work with images:


public image getImage(URL url);//returns an image object given an URL
public image getImage(URL url,String name);//Returns an image object with the URL and the name specified.
 
All About Class Image in AWT in Java All About Class Image in AWT in Java Reviewed by Animesh Chatterjee on December 10, 2018 Rating: 5

No comments:

Powered by Blogger.