return at;
}
public static void main(String[] args) {
final CropMode mode = new CropMode(false);
mode.addCropListener(
new CropListener() {
public void cropCommitted(CropBounds rect) {
System.out.println(rect);
}
public void unCrop() {
System.out.println("uncrop");
}
}
);
JComponent overlay = mode.getOverlay();
final Dot dot = new Dot();
final JPanel panel = new JPanel(new BorderLayout());
panel.add(overlay);
// panel.add(dot);
final JSlider rotor = new JSlider(-45, 45);
final JSlider scalor = new JSlider(-100, 100);
rotor.addChangeListener(
new ChangeListener() {
public void stateChanged(ChangeEvent event) {
int r = rotor.getValue();
double angle = r * Math.PI / 180d;
int s = scalor.getValue();
double scale = Math.pow(10, s / 100d);
int x = panel.getWidth() / 2;
int y = panel.getHeight() / 2;
xform = updateXForm(angle, scale, x, y);
mode.setTransform(xform);
dot.setTransform(xform);
}
}
);
scalor.addChangeListener(
new ChangeListener() {
public void stateChanged(ChangeEvent event) {
int r = rotor.getValue();
double angle = r * Math.PI / 180d;
int s = scalor.getValue();
double scale = Math.pow(10, s / 100d);
int x = panel.getWidth() / 2;
int y = panel.getHeight() / 2;
xform = updateXForm(angle, scale, x, y);
mode.setTransform(xform);
dot.setTransform(xform);
}
}
);
Box ctrls = Box.createHorizontalBox();