JHotDraw 7.4.1

org.jhotdraw.draw.text
Class FloatingTextArea

java.lang.Object
  extended by org.jhotdraw.draw.text.FloatingTextArea

public class FloatingTextArea
extends java.lang.Object

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


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: FloatingTextArea.java -1 $
Author:
Werner Randelshofer

Field Summary
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 Summary
FloatingTextArea()
          Constructor for the FloatingTextArea object
 
Method Summary
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

editScrollContainer

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


textArea

protected javax.swing.JTextArea textArea
The actual editor


view

protected DrawingView view
The drawing view.

Constructor Detail

FloatingTextArea

public FloatingTextArea()
Constructor for the FloatingTextArea object

Method Detail

createOverlay

public void createOverlay(DrawingView view)
Creates the overlay within the given container.

Parameters:
view - the DrawingView

requestFocus

public void requestFocus()

createOverlay

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

Parameters:
view - the DrawingView
figure - the figure holding the text

updateWidget

protected void updateWidget()

setBounds

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

Parameters:
r - the bounding Rectangle2D.Double 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.


Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.