Example usage for java.awt Graphics2D fill

List of usage examples for java.awt Graphics2D fill

Introduction

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

Prototype

public abstract void fill(Shape s);

Source Link

Document

Fills the interior of a Shape using the settings of the Graphics2D context.

Usage

From source file:Main.java

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

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

    r.setBounds(new Rectangle(20, 20, 40, 40));

    g2.fill(r);
}

From source file:ResizeRectangle.java

public void paintComponent(Graphics g) {
    super.paintComponent(g);

    Graphics2D g2 = (Graphics2D) g;

    for (int i = 0; i < points.length; i++) {
        g2.fill(points[i]);
    }//from   w  ww .  ja  v  a2 s  .  com
    s.setRect(points[0].getCenterX(), points[0].getCenterY(),
            Math.abs(points[1].getCenterX() - points[0].getCenterX()),
            Math.abs(points[1].getCenterY() - points[0].getCenterY()));

    g2.draw(s);
}

From source file:Main.java

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

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

    r.intersects(new Rectangle(40, 40, 20, 20));

    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 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(new Point(40, 40)));

    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.equals(new Rectangle(20, 20, 60, 60)));

    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(new Rectangle(40, 40, 20, 20)));

    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.createUnion(new Rectangle(20, 20, 40, 40)));

    g2.fill(r);
}

From source file:Main.java

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

    Rectangle r = new Rectangle();

    r.setLocation(new Point(20, 20));
    r.setSize(new Dimension(10, 10));

    g2.fill(r);
    System.out.println(r.height);

}

From source file:Main.java

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

    Rectangle r = new Rectangle();

    r.setLocation(new Point(20, 20));
    r.setSize(new Dimension(10, 10));

    g2.fill(r);
    System.out.println(r.isEmpty());

}