diva.canvas.tutorial
Class TransformedFigureTutorial

java.lang.Object
  |
  +--diva.canvas.tutorial.TransformedFigureTutorial

public class TransformedFigureTutorial
extends java.lang.Object

An example showing how to make custom figures that contain their own AffineTransform. In the FigureTutorial class, we showed how to make a custom figure, and how to transform the various 2D shapes in the paint() method. Here, we will use an AffineTransform to do the same thing. This technique is a little more work to figure out how to do, but it probably better if your figure has more than a couple of Shapes in it.

Transforms are a little tricky to get right, so the Diva Canvas provides a class, TransformContext, that you need to use to give a figure its own transform. Each instance of TransformContext contains a single AffineTransform, and a bunch of methods that deal with it. See the class documentation for TransformedFigureTutorial.CloudFigure for more details.


Inner Class Summary
 class TransformedFigureTutorial.CloudFigure
          CloudFigure is a class that paints itself as a translucent "cloud." This example figure class illustrates the use of different paints and strokes to create the required image, and the use of TransformContext to position that image.
 
Constructor Summary
TransformedFigureTutorial()
          Create a JCanvas and put it into a window.
 
Method Summary
 void createFigures()
          Create instances of the class defined in this file.
static void main(java.lang.String[] argv)
          Main function
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransformedFigureTutorial

public TransformedFigureTutorial()
Create a JCanvas and put it into a window.
Method Detail

createFigures

public void createFigures()
Create instances of the class defined in this file. To make the demo a little more interesting, make them draggable.

main

public static void main(java.lang.String[] argv)
Main function


Contact 
©2002-2018 U.C. Regents