org.jhotdraw.draw
Class TextTool
java.lang.Object
org.jhotdraw.draw.AbstractTool
org.jhotdraw.draw.CreationTool
org.jhotdraw.draw.TextTool
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, Tool
public class TextTool
- extends CreationTool
- implements java.awt.event.ActionListener
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
| Methods inherited from class org.jhotdraw.draw.AbstractTool |
addToolListener, addUndoableEditListener, constrainPoint, constrainPoint, draw, editCopy, editCut, editDelete, editDuplicate, editPaste, fireAreaInvalidated, fireAreaInvalidated, fireToolDone, fireToolStarted, getDrawing, getEditor, getView, isActive, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mouseMoved, removeToolListener, removeUndoableEditListener, updateCursor, viewToDrawing |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TextTool
public TextTool(TextHolder prototype)
- Creates a new instance.
TextTool
public TextTool(Figure prototype,
java.util.Map attributes)
- Creates a new instance.
deactivate
public void deactivate(DrawingEditor editor)
- Description copied from interface:
Tool
- Deactivates the tool. This method is called whenever the user
switches to another tool. Use this method to do some clean-up
when the tool is switched. Subclassers should always call
super.deactivate.
- Specified by:
deactivate in interface Tool- Overrides:
deactivate in class CreationTool
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- If the pressed figure is a TextHolder it can be edited otherwise
a new text figure is created.
- Specified by:
mousePressed in interface java.awt.event.MouseListener- Overrides:
mousePressed in class CreationTool
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
- Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener- Overrides:
mouseDragged in class CreationTool
beginEdit
protected void beginEdit(TextHolder textHolder)
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent evt)
- Specified by:
mouseReleased in interface java.awt.event.MouseListener- Overrides:
mouseReleased in class CreationTool
endEdit
protected void endEdit()
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent event)
- Specified by:
actionPerformed in interface java.awt.event.ActionListener