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:Main.java

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

    CubicCurve2D cubcurve = new CubicCurve2D.Float(30, 400, 150, 400, 200, 500, 350, 450);
    g2d.draw(cubcurve);

    System.out.println(cubcurve.contains(0.2F, 0.3F));
}

From source file:Main.java

public void paint(Graphics g) {
    Graphics2D graphics2 = (Graphics2D) g;
    RoundRectangle2D roundedRectangle = new RoundRectangle2D.Float(100, 100, 240, 160, 10, 10);
    graphics2.draw(roundedRectangle);
}

From source file:Main.java

public void paint(Graphics g) {
    Graphics2D graphics2 = (Graphics2D) g;
    RoundRectangle2D roundedRectangle = new RoundRectangle2D.Float(10, 10, 240, 160, 10, 10);
    graphics2.draw(roundedRectangle);
}

From source file:Main.java

public void paint(Graphics g) {
    Shape shape = new Rectangle2D.Float(100, 50, 80, 80);

    Graphics2D g2 = (Graphics2D) g;

    AffineTransform at = AffineTransform.getRotateInstance(-Math.PI / 6);

    g2.setTransform(at);//from   w  w  w  .  j  a v  a  2s . c om
    g2.draw(shape);

}

From source file:Main.java

public void paint(Graphics g) {
    Shape shape = new Rectangle2D.Float(100, 50, 80, 80);

    Graphics2D g2 = (Graphics2D) g;

    AffineTransform at = new AffineTransform();
    at.rotate(0.5);/*from   w w w . j a va2s  .c o m*/

    g2.setTransform(at);
    g2.draw(shape);

}

From source file:Main.java

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

    g2.setPaint(Color.black);//  w  w w .j  ava2s  .  c o m
    g2.setStroke(new BasicStroke(8, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
    g2.draw(new Ellipse2D.Double(20, 20, 50, 50));
}

From source file:MainClass.java

public void paint(Graphics g) {
    Shape shape = new Rectangle2D.Float(100, 50, 80, 80);

    Graphics2D g2 = (Graphics2D) g;

    AffineTransform at = new AffineTransform();
    at.shear(-.5, 0);//from  w ww.j  av  a  2s. c o m

    g2.setTransform(at);
    g2.draw(shape);

}

From source file:Main.java

public void paint(Graphics g) {
    Shape shape = new Rectangle2D.Float(100, 50, 80, 80);

    Graphics2D g2 = (Graphics2D) g;

    AffineTransform at = new AffineTransform();
    at.scale(0.3, 0.2);/*w w w .  j a  v a2 s .co m*/

    g2.setTransform(at);
    g2.draw(shape);

}

From source file:Main.java

public void paint(Graphics g) {
    Shape shape = new Rectangle2D.Float(100, 50, 80, 80);

    Graphics2D g2 = (Graphics2D) g;

    AffineTransform at = new AffineTransform();
    at.rotate(0.5, 0.3);/*from   w  w w  .j a  v a 2 s  .  co  m*/

    g2.setTransform(at);
    g2.draw(shape);

}

From source file:Main.java

public void paint(Graphics g) {
    Shape shape = new Rectangle2D.Float(100, 50, 80, 80);

    Graphics2D g2 = (Graphics2D) g;

    AffineTransform at = new AffineTransform();
    at.rotate(0.2, 0.5, 0.3);/*from w w w . ja v a2  s .  com*/

    g2.setTransform(at);
    g2.draw(shape);

}