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) {
    Shape shape = new Rectangle2D.Float(100, 50, 80, 80);

    Graphics2D g2 = (Graphics2D) g;

    AffineTransform at = new AffineTransform();
    at.setToRotation(Math.PI / 6, Math.PI / 6);
    at.translate(100, 0);//from  ww  w  .  j  a va2s  . 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.setToRotation(0.2, Math.PI / 6, Math.PI / 6);
    at.translate(100, 0);// w w w . j  a  v a 2 s .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.setToRotation(0.2, 0.2, Math.PI / 6, Math.PI / 6);
    at.translate(100, 0);/*from  w w w  . ja  v  a2  s. co  m*/

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

}

From source file:Main.java

public void repaint(BufferedImage orig, BufferedImage copy) {
    Graphics2D g = copy.createGraphics();
    g.drawImage(orig, 0, 0, null);/*w ww. j  ava2  s.  c  o  m*/
    g.setColor(Color.RED);
    if (captureRect == null) {
        return;
    }
    g.draw(captureRect);
    g.setColor(new Color(25, 25, 23, 10));
    g.fill(captureRect);
    g.dispose();
}

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.setToQuadrantRotation(2, 0.5, 0.5);

    System.out.println(at.getScaleX());

    g2.setTransform(at);/*from   w w  w  . j  a  v a2  s  .co m*/
    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.setToQuadrantRotation(2, 0.5, 0.5);

    System.out.println(at.getShearY());

    g2.setTransform(at);/*from   w w w.j  a  va2 s  .  com*/
    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.setToQuadrantRotation(2, 0.5, 0.5);

    System.out.println(at.getScaleY());

    g2.setTransform(at);//  w  w w  .ja va2s . 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.setToQuadrantRotation(2, 0.5, 0.5);

    System.out.println(at.getShearX());

    g2.setTransform(at);//from   ww  w  . j  ava  2 s  .  c o  m
    g2.draw(shape);

}

From source file:QandE.XMarksTheSpot.java

protected void paintComponent(Graphics g) {
    if (isOpaque()) {
        g.setColor(getBackground());/* w ww .  j av a 2s  . c  o  m*/
        g.fillRect(0, 0, getWidth(), getHeight());
        g.setColor(getForeground());
    }

    Graphics2D g2 = (Graphics2D) g;
    Insets insets = getInsets();
    g2.setStroke(new BasicStroke(5.0f));
    g2.draw(new Line2D.Double(insets.left, insets.top, getWidth() - insets.right, getHeight() - insets.bottom));
    g2.draw(new Line2D.Double(insets.left, getHeight() - insets.bottom, getWidth() - insets.right, insets.top));
}

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.setToQuadrantRotation(2, 0.5, 0.5);

    System.out.println(at.getTranslateX());

    g2.setTransform(at);/*w w w  . ja va  2  s. c o  m*/
    g2.draw(shape);

}