com.rolemodelsoft.drawlet.shapes.lines
Class ConnectingLineTool
java.lang.Object
|
+--com.rolemodelsoft.drawlet.basics.AbstractInputEventHandler
|
+--com.rolemodelsoft.drawlet.basics.CanvasTool
|
+--com.rolemodelsoft.drawlet.basics.ConstructionTool
|
+--com.rolemodelsoft.drawlet.shapes.ShapeTool
|
+--com.rolemodelsoft.drawlet.shapes.lines.LineTool
|
+--com.rolemodelsoft.drawlet.shapes.lines.ConnectingLineTool
- Direct Known Subclasses:
- AdornedLineTool
- public class ConnectingLineTool
- extends LineTool
This tool produces ConnectingLines.
|
Constructor Summary |
ConnectingLineTool(DrawingCanvas canvas)
Constructs and initializes a new instance of a tool to create connecting
lines on a DrawingCanvas. |
|
Method Summary |
protected Figure |
basicNewFigure(int x,
int y)
Create and answer a new Figure. |
void |
mousePressed(java.awt.event.MouseEvent e)
Called if the mouse goes down. |
void |
mouseReleased(java.awt.event.MouseEvent e)
Called if the mouse is released. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
ConnectingLineTool
public ConnectingLineTool(DrawingCanvas canvas)
- Constructs and initializes a new instance of a tool to create connecting
lines on a DrawingCanvas.
- Parameters:
canvas - the canvas on which to place lines.
basicNewFigure
protected Figure basicNewFigure(int x,
int y)
- Create and answer a new Figure.
- Overrides:
- basicNewFigure in class LineTool
- Parameters:
x - the x coordinatey - the y coordinate
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Called if the mouse goes down.
When creating the new line, see if the first point is on top of another
figure, and connect it if possible.
- Overrides:
- mousePressed in class ShapeTool
- Parameters:
e - the event
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Called if the mouse is released.
If we are constructing a line, finalize the
latest point by seeing if it is one that could connect to an underlying
figure and, if so connect it. We're done constructing this
one unless the shift key is down in which case we add another point
and keep going.
Otherwise, get ready to construct the next one.
- Overrides:
- mouseReleased in class LineTool
- Parameters:
e - the event