Java GraphicsConfiguration .createCompatibleImage (int width, int height)
Syntax
GraphicsConfiguration.createCompatibleImage(int width, int height) has the following syntax.
public BufferedImage createCompatibleImage(int width, int height)
Example
In the following code shows how to use GraphicsConfiguration.createCompatibleImage(int width, int height) method.
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Transparency;
import java.awt.image.BufferedImage;
/*from w ww . j a va 2s. c o m*/
public class Main {
public static void main(String[] argv) throws Exception {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gs = ge.getDefaultScreenDevice();
GraphicsConfiguration gc = gs.getDefaultConfiguration();
// Create an image that does not support transparency
BufferedImage bimage = gc.createCompatibleImage(100, 100);
}
}
Home »
Java Tutorial »
java.awt »
Java Tutorial »
java.awt »