Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.awt.*;
import java.awt.image.BufferedImage;

public class Main {
    /** An array of the screen devices. */
    private static GraphicsDevice[] screenDevices;

    public static BufferedImage createImage(final int width, final int height) {
        initScreenDevices();
        return screenDevices[0].getDefaultConfiguration().createCompatibleImage(width, height);
    }

    private static void initScreenDevices() {
        final GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
        screenDevices = graphicsEnvironment.getScreenDevices();
    }
}