AffineTransformGetShearInstance.java Source code

Java tutorial

Introduction

Here is the source code for AffineTransformGetShearInstance.java

Source

import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;

public class AffineTransformGetShearInstance extends Frame {
    public static void main(String[] args) {
        (new AffineTransformGetShearInstance()).setVisible(true);
    }

    public AffineTransformGetShearInstance() {
        setSize(350, 300);
    }

    public void paint(Graphics g) {
        AffineTransform atrans = null;

        Graphics2D g2d = (Graphics2D) g;
        atrans = AffineTransform.getShearInstance(.1, .5);

        if (atrans != null)
            g2d.setTransform(atrans);

        g2d.fillRect(50, 50, 100, 50);
    }
}