org.jhotdraw.contrib
Class FloatingTextArea

java.lang.Object
  extended byorg.jhotdraw.contrib.FloatingTextArea

public class FloatingTextArea
extends java.lang.Object

A FloatingTextArea overlays an editor on top of an area in a drawing

Version:
<$CURRENT_VERSION$>

Field Summary
protected  java.awt.Container fContainer
          The container within which the editor is created
protected  javax.swing.JScrollPane fEditScrollContainer
          A scroll pane to allow for vertical scrolling while editing
protected  javax.swing.JEditorPane fEditWidget
          The actual editor
 
Constructor Summary
FloatingTextArea()
          Constructor for the FloatingTextArea object
 
Method Summary
 void createOverlay(java.awt.Container container)
          Creates the overlay within the given container.
 void createOverlay(java.awt.Container container, java.awt.Font font)
          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 setBounds(java.awt.Rectangle r, java.lang.String text)
          Positions and sizes the overlay.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fEditScrollContainer

protected javax.swing.JScrollPane fEditScrollContainer
A scroll pane to allow for vertical scrolling while editing


fEditWidget

protected javax.swing.JEditorPane fEditWidget
The actual editor


fContainer

protected java.awt.Container fContainer
The container within which the editor is created

Constructor Detail

FloatingTextArea

public FloatingTextArea()
Constructor for the FloatingTextArea object

Method Detail

createOverlay

public void createOverlay(java.awt.Container container)
Creates the overlay within the given container.

Parameters:
container - the container

createOverlay

public void createOverlay(java.awt.Container container,
                          java.awt.Font font)
Creates the overlay for the given Container using a specific font.

Parameters:
container - the container
font - the font

setBounds

public void setBounds(java.awt.Rectangle r,
                      java.lang.String text)
Positions and sizes the overlay.

Parameters:
r - the bounding rectangle for the overlay
text - the text to edit

getText

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

Returns:
The text value

getPreferredSize

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

Parameters:
cols - Description of the Parameter
Returns:
The preferredSize value

endOverlay

public void endOverlay()
Removes the overlay.