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(100, 100, 200, 200);

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

}

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

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

}

From source file:Main.java

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

    Rectangle r = new Rectangle(new Dimension(10, 10));

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

From source file:Main.java

@Override
protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2d = (Graphics2D) g.create();
    g2d.setColor(Color.RED);//  w  ww .j  a  va  2  s .co m
    g2d.fill(poly);

    g2d.setColor(Color.GREEN);
    g2d.translate(50, 100);
    g2d.fill(triangleShape);
    g2d.dispose();
}

From source file:Main.java

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

    Rectangle r = new Rectangle(new Point(10, 10), new Dimension(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);

    r.add(40, 40);/*from   ww  w .  ja  v a  2s .c o  m*/

    g2.fill(r);

}

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 ava 2 s . co  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);

    r.translate(20, 20);/* w  w w  .  java  2  s.  co  m*/

    g2.fill(r);
}