Example usage for java.awt Rectangle Rectangle

List of usage examples for java.awt Rectangle Rectangle

Introduction

In this page you can find the example usage for java.awt Rectangle Rectangle.

Prototype

public Rectangle(int x, int y, int width, int height) 

Source Link

Document

Constructs a new Rectangle whose upper-left corner is specified as (x,y) and whose width and height are specified by the arguments of the same name.

Usage

From source file:Main.java

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)));

    System.out.println(shape.intersects(new Rectangle(1, 1, 1, 1)));
}

From source file:BasicShapes.java

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)));
}

From source file:Main.java

public static void main(String[] args) {
    AffineTransform tx = new AffineTransform();
    tx.scale(1, 1);//from www.java2s.co  m
    Rectangle shape = new Rectangle(1, 1, 1, 1);
    Shape newShape = tx.createTransformedShape(shape);

    System.out.println("done");
}

From source file:Main.java

public static void main(String[] args) {
    AffineTransform tx = new AffineTransform();
    tx.rotate(0.5);//from  w  ww  .  j a  va 2 s . co m
    Rectangle shape = new Rectangle(1, 1, 1, 1);
    Shape newShape = tx.createTransformedShape(shape);

    System.out.println("done");
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Shape s = new Rectangle2D.Double(0, 0, 72, 72);

    System.out.println(s.contains(new Rectangle(30, 40, 30, 30)));
}

From source file:Main.java

public static void main(String[] args) {
    AffineTransform tx = new AffineTransform();
    tx.shear(1, 1);//from   www.  j a  v  a2  s .  c  om
    Rectangle shape = new Rectangle(1, 1, 1, 1);
    Shape newShape = tx.createTransformedShape(shape);

    System.out.println("done");

}

From source file:BasicShapes.java

public static void main(String[] args) {
    AffineTransform tx = new AffineTransform();
    tx.rotate(0.5);/*from w  ww . ja  v  a 2s.co m*/
    Rectangle shape = new Rectangle(1, 1, 1, 1);
    Shape newShape = tx.createTransformedShape(shape);
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Shape s = new Rectangle2D.Double(0, 0, 72, 72);

    System.out.println(s.intersects(new Rectangle(10, 10, 20, 20)));
}

From source file:BasicShapes.java

public static void main(String[] args) {
    AffineTransform tx = new AffineTransform();
    tx.scale(1, 1);//from  w  w w  .j  a v  a 2  s .c o m
    Rectangle shape = new Rectangle(1, 1, 1, 1);
    Shape newShape = tx.createTransformedShape(shape);

}

From source file:BasicShapes.java

public static void main(String[] args) {
    AffineTransform tx = new AffineTransform();
    tx.shear(1, 1);//from  w w w  .  j ava  2  s . co  m
    Rectangle shape = new Rectangle(1, 1, 1, 1);
    Shape newShape = tx.createTransformedShape(shape);

}