BasicShapes.java Source code

Java tutorial

Introduction

Here is the source code for BasicShapes.java

Source

import java.awt.Rectangle;
import java.awt.geom.Area;

public class BasicShapes {
    public static void main(String[] args) {
        Area shape = new Area(new Rectangle(1, 1, 1, 1));
        shape.add(new Area(new Rectangle(1, 1, 1, 1)));
        shape.subtract(new Area(new Rectangle(1, 1, 1, 1)));
        shape.intersect(new Area(new Rectangle(1, 1, 1, 1)));
        shape.exclusiveOr(new Area(new Rectangle(1, 1, 1, 1)));
    }
}