GraphicsConfiguration.createCompatibleImage(int width, int height) has the following syntax.
public BufferedImage createCompatibleImage(int width, int height)
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 w w . j av a2 s .co 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); } }