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 void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    Rectangle r = new Rectangle(100, 100, 200, 200);

    g2.fill(r);//from  w  w  w . j  a v  a 2  s  .  c  o m
    System.out.println(r.getX());

}

From source file:Main.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    Rectangle r = new Rectangle(10, 10, 50, 40);

    System.out.println(r.createIntersection(new Rectangle(20, 20, 40, 40)));

    g2.fill(r);/*w  w w .j a  v  a  2s  .c  om*/
}

From source file:Main.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    Rectangle r = new Rectangle(100, 100, 200, 200);

    g2.fill(r);// w  ww  . j  av a2s  .co m
    System.out.println(r.getWidth());

}

From source file:Main.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    Rectangle r = new Rectangle(100, 100, 200, 200);

    g2.fill(r);//from  w  w w  .j  a va 2  s.co  m
    System.out.println(r.getBounds());

}

From source file:Main.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    Rectangle r = new Rectangle(100, 100, 200, 200);
    r.grow(-25, -50);/*w  w  w  .  j a  v a2  s  .c  o  m*/
    g2.fill(r);
    System.out.println(r);

}

From source file:Main.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    Rectangle r = new Rectangle(10, 10, 50, 40);

    System.out.println(r.createUnion(new Rectangle(20, 20, 40, 40)));

    g2.fill(r);//from   ww w.j  av a  2s. co  m
}

From source file:Main.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    Rectangle r = new Rectangle(100, 100, 200, 200);

    g2.fill(r);/*from w ww. j a va 2  s. c  o m*/
    System.out.println(r.getHeight());

}

From source file:Main.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    Rectangle r = new Rectangle(10, 10, 50, 40);

    Rectangle newR = new Rectangle(r);

    g2.fill(newR);/*from  ww w .  j av a  2s . c o m*/

}

From source file:Main.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    Rectangle r = new Rectangle(10, 10, 50, 40);

    r.add(40, 40);//from   w  w  w  .j a v  a2  s .  c o  m

    g2.fill(r);

}

From source file:Main.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    Rectangle r = new Rectangle(10, 10, 50, 40);

    System.out.println(r.contains(40, 40, 10, 10));

    g2.fill(r);//from www .  j a  v  a  2s . c o  m

}