org.jhotdraw.draw
Class FloatingTextField

java.lang.Object
  extended by org.jhotdraw.draw.FloatingTextField

public class FloatingTextField
extends java.lang.Object

A floating text field that is used to edit a TextHolderFigure.

FloatingTextField requires a two step initialization: In a first step the overlay is created and in a second step it can be positioned.


Design Patterns

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.


Version:
$Id: FloatingTextField.java 564 2009-10-10 10:21:01Z rawcoder $
Author:
Werner Randelshofer
See Also:
TextFigure

Field Summary
private  TextHolderFigure editedFigure
           
private  FigureListener figureHandler
           
private  javax.swing.JTextField textField
           
private  DrawingView view
           
 
Constructor Summary
FloatingTextField()
           
 
Method Summary
 void addActionListener(java.awt.event.ActionListener listener)
          Adds an action listener
 void createOverlay(DrawingView view)
          Creates the overlay for the given Component.
 void createOverlay(DrawingView view, TextHolderFigure figure)
          Creates the overlay for the given Container using a specific font.
 void endOverlay()
          Removes the overlay.
 java.awt.Insets getInsets()
           
 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 removeActionListener(java.awt.event.ActionListener listener)
          Remove an action listener
 void requestFocus()
           
protected  void updateWidget()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

editedFigure

private TextHolderFigure editedFigure

textField

private javax.swing.JTextField textField

view

private DrawingView view

figureHandler

private FigureListener figureHandler
Constructor Detail

FloatingTextField

public FloatingTextField()
Method Detail

createOverlay

public void createOverlay(DrawingView view)
Creates the overlay for the given Component.


requestFocus

public void requestFocus()

createOverlay

public void createOverlay(DrawingView view,
                          TextHolderFigure figure)
Creates the overlay for the given Container using a specific font.


updateWidget

protected void updateWidget()

getInsets

public java.awt.Insets getInsets()

addActionListener

public void addActionListener(java.awt.event.ActionListener listener)
Adds an action listener


removeActionListener

public void removeActionListener(java.awt.event.ActionListener listener)
Remove an action listener


getText

public java.lang.String getText()
Gets the text contents of the overlay.


getPreferredSize

public java.awt.Dimension getPreferredSize(int cols)
Gets the preferred size of the overlay.


endOverlay

public void endOverlay()
Removes the overlay.