CH.ifa.draw.figures
Class TextTool
- java.lang.Object
-
- CH.ifa.draw.standard.AbstractTool
-
- CH.ifa.draw.standard.CreationTool
-
- CH.ifa.draw.figures.TextTool
-
- All Implemented Interfaces:
- Tool
- Direct Known Subclasses:
- ConnectedTextTool
public class TextTool extends CreationTool
Tool to create new or edit existing text figures. The editing behavior is implemented by overlaying the Figure providing the text with a FloatingTextField.A tool interaction is done once a Figure that is not a TextHolder is clicked.
- See Also:
TextHolder,FloatingTextField
-
-
Constructor Summary
Constructors Constructor and Description TextTool(DrawingView view, Figure prototype)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidactivate()Sets the text cursor.voiddeactivate()Terminates the editing of a text figure.booleanisActivated()Test whether the text tool is currently activated and is displaying a overlay TextFigure for accepting input.voidmouseDown(java.awt.event.MouseEvent e, int x, int y)If the pressed figure is a TextHolder it can be edited otherwise a new text figure is created.voidmouseDrag(java.awt.event.MouseEvent e, int x, int y)Adjusts the extent of the created figurevoidmouseUp(java.awt.event.MouseEvent e, int x, int y)Checks if the created figure is empty.
-
-
-
Constructor Detail
-
TextTool
public TextTool(DrawingView view, Figure prototype)
-
-
Method Detail
-
mouseDown
public void mouseDown(java.awt.event.MouseEvent e, int x, int y)If the pressed figure is a TextHolder it can be edited otherwise a new text figure is created.- Specified by:
mouseDownin interfaceTool- Overrides:
mouseDownin classCreationTool
-
mouseDrag
public void mouseDrag(java.awt.event.MouseEvent e, int x, int y)Description copied from class:CreationToolAdjusts the extent of the created figure- Specified by:
mouseDragin interfaceTool- Overrides:
mouseDragin classCreationTool
-
mouseUp
public void mouseUp(java.awt.event.MouseEvent e, int x, int y)Description copied from class:CreationToolChecks if the created figure is empty. If it is, the figure is removed from the drawing.- Specified by:
mouseUpin interfaceTool- Overrides:
mouseUpin classCreationTool- See Also:
Figure.isEmpty()
-
deactivate
public void deactivate()
Terminates the editing of a text figure.- Specified by:
deactivatein interfaceTool- Overrides:
deactivatein classAbstractTool
-
activate
public void activate()
Sets the text cursor.- Specified by:
activatein interfaceTool- Overrides:
activatein classCreationTool
-
isActivated
public boolean isActivated()
Test whether the text tool is currently activated and is displaying a overlay TextFigure for accepting input.- Returns:
- true, if the text tool has a accepting target TextFigure for its input, false otherwise
-
-
DataMelt 3.0 © DataMelt by jWork.ORG