Example usage for java.awt Graphics2D draw

List of usage examples for java.awt Graphics2D draw

Introduction

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

Prototype

public abstract void draw(Shape s);

Source Link

Document

Strokes the outline of a Shape using the settings of the current Graphics2D context.

Usage

From source file:MainClass.java

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

    g2.setPaint(Color.black);
    g2.draw(shape);
}

From source file:Main.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    Line2D lin = new Line2D.Float(100, 100, 250, 260);
    g2.draw(lin);
}

From source file:Main.java

public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2 = (Graphics2D) g;
    Line2D lin = new Line2D.Float(100, 100, 250, 260);
    g2.draw(lin);
}

From source file:MainClass.java

public void paint(Graphics g) {
    Graphics2D g2d = (Graphics2D) g;
    Rectangle2D r2d = new Rectangle2D.Float(10f, 10f, 130f, 130f);
    g2d.draw(r2d);
}

From source file:MainClass.java

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

    Arc2D arc = new Arc2D.Float(200, 50, 100, 50, 0, 90, Arc2D.PIE);
    g2d.draw(arc);

}

From source file:MainClass.java

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

    Arc2D arc = new Arc2D.Float(200, 50, 100, 50, 0, 90, Arc2D.OPEN);
    g2d.draw(arc);

}

From source file:MainClass.java

public void paint(Graphics g) {
    RoundRectangle2D rrect;/*  w w w.ja va  2 s  .  com*/

    Graphics2D g2d = (Graphics2D) g;

    rrect = new RoundRectangle2D.Float(50, 50, 100, 200, 30, 20);
    g2d.draw(rrect);

}

From source file:MainClass.java

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

    Arc2D arc = new Arc2D.Float(200, 50, 100, 50, 0, 90, Arc2D.CHORD);
    g2d.draw(arc);

}

From source file:Main.java

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

    g2.setPaint(Color.black);//from w  ww. j  ava  2s .c o m
    g2.setStroke(new BasicStroke());
    g2.draw(new Ellipse2D.Double(20, 20, 50, 50));
}

From source file:Main.java

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

    g2.setPaint(Color.black);/*from  w w  w . j  a  v a 2 s. c om*/
    g2.setStroke(new BasicStroke(8));
    g2.draw(new Ellipse2D.Double(20, 20, 50, 50));
}