Documentation of 'org.jhotdraw.samples.mini.StraightLineFigure' Java class
StraightLineFigure
org.jhotdraw.samples.mini

Class StraightLineFigure

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Figure, DOMStorable


    public class StraightLineFigure
    extends AbstractAttributedFigure
    Example showing the minimal amount of code needed to implement a Figure by extending AbstractAttributedFigure.
    See Also:
    Serialized Form
    • Constructor Detail

      • StraightLineFigure

        public StraightLineFigure()
        Creates a new instance.
    • Method Detail

      • transform

        public void transform(java.awt.geom.AffineTransform ty)
        Description copied from interface: Figure
        Transforms the shape of the Figure. Transformations using double precision arithmethics are inherently lossy operations. Therefore it is recommended to use getTransformRestoreData() restoreTransformTo() to provide lossless undo/redo functionality.

        This is a basic operation which does not fire events. Use the following code sequence, if you need event firing:

         figure.willChange();
         figure.transform(...);
         figure.changed();
         
        Parameters:
        ty - The transformation.
        See Also:
        Figure.getTransformRestoreData(), Figure.restoreTransformTo(java.lang.Object)
      • setBounds

        public void setBounds(java.awt.geom.Point2D.Double start,
                              java.awt.geom.Point2D.Double end)
        Description copied from interface: Figure
        Sets the logical and untransformed bounds of the figure.

        This is used by Tool's which create a new Figure and by Tool's which connect a Figure to another Figure.

        This is a basic operation which does not fire events. Use the following code sequence, if you need event firing:

         figure.willChange();
         figure.setBounds(...);
         figure.changed();
         
        Specified by:
        setBounds in interface Figure
        Overrides:
        setBounds in class AbstractFigure
        Parameters:
        start - the start point of the bounds
        end - the end point of the bounds
        See Also:
        Figure.getBounds()
      • getBounds

        public java.awt.geom.Rectangle2D.Double getBounds()
        Description copied from interface: Figure
        Returns the untransformed logical bounds of the figure as a Rectangle.

        The bounds are used by Handle objects for adjusting the figure and for aligning the figure on a grid.

      • getTransformRestoreData

        public java.lang.Object getTransformRestoreData()
        Description copied from interface: Figure
        Gets data which can be used to restore the transformation of the figure without loss of precision, after a transform has been applied to it.
        See Also:
        Figure.transform(AffineTransform)
      • restoreTransformTo

        public void restoreTransformTo(java.lang.Object restoreData)
        Description copied from interface: Figure
        Restores the transform of the figure to a previously stored state.
      • contains

        public boolean contains(java.awt.geom.Point2D.Double p)
        Description copied from interface: Figure
        Checks if a point is contained by the figure.

        This is used for hit testing by Tool's.

      • clone

        public StraightLineFigure clone()
        Description copied from interface: Figure
        Returns a clone of the figure, with clones of all aggregated figures, such as children and decorators. The cloned figure does not clone the list of FigureListeners from its original.
        Specified by:
        clone in interface Figure
        Overrides:
        clone in class AbstractAttributedFigure

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.