Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import java.awt.image.BufferedImage;
import java.io.File;

import javax.imageio.ImageIO;

public class Main {

    static public void main(String args[]) throws Exception {
        int width = 200, height = 200;
        BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);

        Graphics2D ig2 = bi.createGraphics();
        ig2.fillRect(0, 0, width - 1, height - 1);

        BasicStroke stroke = new BasicStroke(10, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
        ig2.setPaint(Color.lightGray);
        ig2.setStroke(stroke);
        ig2.draw(new Ellipse2D.Double(0, 0, 100, 100));

        ImageIO.write(bi, "GIF", new File("a.gif"));
    }
}