public class FloatingTextArea
extends java.lang.Object
TextHolderFigure.
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.
| Modifier and Type | Field and Description |
|---|---|
protected javax.swing.JScrollPane |
editScrollContainer
A scroll pane to allow for vertical scrolling while editing
|
protected javax.swing.JTextArea |
textArea
The actual editor
|
protected DrawingView |
view
The drawing view.
|
| Constructor and Description |
|---|
FloatingTextArea()
Constructor for the FloatingTextArea object
|
| Modifier and Type | Method and Description |
|---|---|
void |
createOverlay(DrawingView view)
Creates the overlay within the given container.
|
void |
createOverlay(DrawingView view,
TextHolderFigure figure)
Creates the overlay for the given Container using a
specific font.
|
void |
endOverlay()
Removes the overlay.
|
java.awt.Dimension |
getPreferredSize(int cols)
Gets the preferred size of the overlay.
|
java.lang.String |
getText()
Gets the text contents of the overlay.
|
void |
requestFocus() |
void |
setBounds(java.awt.geom.Rectangle2D.Double r,
java.lang.String text)
Positions and sizes the overlay.
|
protected void |
updateWidget() |
protected javax.swing.JScrollPane editScrollContainer
protected javax.swing.JTextArea textArea
protected DrawingView view
public FloatingTextArea()
public void createOverlay(DrawingView view)
view - the DrawingViewpublic void requestFocus()
public void createOverlay(DrawingView view, TextHolderFigure figure)
view - the DrawingViewfigure - the figure holding the textprotected void updateWidget()
public void setBounds(java.awt.geom.Rectangle2D.Double r,
java.lang.String text)
r - the bounding Rectangle2D.Double for the overlaytext - the text to editpublic java.lang.String getText()
public java.awt.Dimension getPreferredSize(int cols)
cols - Description of the Parameterpublic void endOverlay()