Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.awt.Component;

import java.awt.Graphics;

import java.awt.image.BufferedImage;

public class Main {
    public static BufferedImage createImage(Component comp) {
        if (comp == null)
            return null;

        BufferedImage image = (BufferedImage) comp.createImage(comp.getWidth(), comp.getHeight());
        Graphics g = image.createGraphics();
        comp.paintAll(g);
        return image;
    }
}