All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class CH.ifa.draw.standard.CreationTool

java.lang.Object
   |
   +----CH.ifa.draw.standard.AbstractTool
           |
           +----CH.ifa.draw.standard.CreationTool

public class CreationTool
extends AbstractTool
A tool to create new figures. The figure to be created is specified by a prototype.
Design Patterns

 o Prototype
CreationTool creates new figures by cloning a prototype.


See Also:
Figure, clone

Constructor Index

 o CreationTool(DrawingView)
Constructs a CreationTool without a prototype.
 o CreationTool(DrawingView, Figure)
Initializes a CreationTool with the given prototype.

Method Index

 o activate()
Sets the cross hair cursor.
 o createdFigure()
Gets the currently created figure
 o createFigure()
Creates a new figure by cloning the prototype.
 o mouseDown(MouseEvent, int, int)
Creates a new figure by cloning the prototype.
 o mouseDrag(MouseEvent, int, int)
Adjusts the extent of the created figure
 o mouseUp(MouseEvent, int, int)
Checks if the created figure is empty.

Constructors

 o CreationTool
 public CreationTool(DrawingView view,
                     Figure prototype)
Initializes a CreationTool with the given prototype.

 o CreationTool
 protected CreationTool(DrawingView view)
Constructs a CreationTool without a prototype. This is for subclassers overriding createFigure.

Methods

 o activate
 public void activate()
Sets the cross hair cursor.

Overrides:
activate in class AbstractTool
 o mouseDown
 public void mouseDown(MouseEvent e,
                       int x,
                       int y)
Creates a new figure by cloning the prototype.

Overrides:
mouseDown in class AbstractTool
 o createFigure
 protected Figure createFigure()
Creates a new figure by cloning the prototype.

 o mouseDrag
 public void mouseDrag(MouseEvent e,
                       int x,
                       int y)
Adjusts the extent of the created figure

Overrides:
mouseDrag in class AbstractTool
 o mouseUp
 public void mouseUp(MouseEvent e,
                     int x,
                     int y)
Checks if the created figure is empty. If it is, the figure is removed from the drawing.

Overrides:
mouseUp in class AbstractTool
See Also:
isEmpty
 o createdFigure
 protected Figure createdFigure()
Gets the currently created figure


All Packages  Class Hierarchy  This Package  Previous  Next  Index