public class TextAreaEditingTool extends AbstractTool implements java.awt.event.ActionListener
To edit an existing text figure using the TextAreaEditingTool, the user does the following mouse gesture on a DrawingView:
The TextAreaEditingTool then uses Figure.findFigureInside to find a Figure that implements the TextHolderFigure interface and that is editable. Then it overlays a text area over the drawing where the user can enter the text for the Figure.
Framework
The text creation and editing tools and the TextHolderFigure
interface define together the contracts of a smaller framework inside of the
JHotDraw framework for structured drawing editors.
Contract: TextHolderFigure, TextCreationTool,
TextAreaCreationTool, TextEditingTool,
TextAreaEditingTool, FloatingTextField,
FloatingTextArea.
TextHolderFigure,
FloatingTextArea,
Serialized Formanchor, editor, isWorking, listenerListpropertySupport| Constructor and Description |
|---|
TextAreaEditingTool(TextHolderFigure typingTarget)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent event) |
protected void |
beginEdit(TextHolderFigure textHolder) |
void |
deactivate(DrawingEditor editor)
Deactivates the tool.
|
void |
draw(java.awt.Graphics2D g)
Draws the tool.
|
protected void |
endEdit() |
void |
mouseDragged(java.awt.event.MouseEvent e) |
void |
mousePressed(java.awt.event.MouseEvent e)
Creates a new figure at the mouse location.
|
activate, addToolListener, addUndoableEditListener, constrainPoint, constrainPoint, createActionMap, createInputMap, editCopy, editCut, editDelete, editDuplicate, editPaste, fireAreaInvalidated, fireAreaInvalidated, fireBoundsInvalidated, fireToolDone, fireToolStarted, getActionMap, getDrawing, getEditor, getInputMap, getToolTipText, getView, isActive, keyPressed, keyReleased, keyTyped, maybeFireBoundsInvalidated, mouseClicked, mouseEntered, mouseExited, mouseMoved, mouseReleased, removeToolListener, removeUndoableEditListener, setActionMap, setInputMap, supportsHandleInteraction, updateCursor, viewToDrawingaddPropertyChangeListener, addPropertyChangeListener, clone, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListenerpublic TextAreaEditingTool(TextHolderFigure typingTarget)
public void deactivate(DrawingEditor editor)
Tooldeactivate in interface Tooldeactivate in class AbstractToolpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenermousePressed in class AbstractToolpublic void draw(java.awt.Graphics2D g)
Tooldraw in interface Tooldraw in class AbstractToolprotected void beginEdit(TextHolderFigure textHolder)
protected void endEdit()
public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed in interface java.awt.event.ActionListenerpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListener