edu.stanford.hci.r3.paper.regions
Class TextRegion

java.lang.Object
  extended by edu.stanford.hci.r3.paper.Region
      extended by edu.stanford.hci.r3.paper.regions.TextRegion

public class TextRegion
extends Region

Represents some text that can be drawn on a page.

This software is distributed under the BSD License.


Field Summary
 
Fields inherited from class edu.stanford.hci.r3.paper.Region
referenceUnits, scaleX, scaleY
 
Constructor Summary
TextRegion(java.lang.String name, java.lang.String theText, java.awt.Font theFont, Units origX, Units origY)
           
TextRegion(java.lang.String name, java.lang.String theText, java.awt.Font theFont, Units origX, Units origY, Units width, Units height)
           
 
Method Summary
 java.awt.Color getColor()
           
 java.awt.Font getFont()
           
 java.lang.String[] getLinesOfText()
           
 int getMaxLines()
           
 RegionRenderer getRenderer()
          Subclasses should override this, to customize rendering.
 java.lang.String getText()
           
 Units getX()
           
 Units getY()
           
 boolean isLineWrapped()
           
 void setColor(java.awt.Color c)
           
 void setLineWrapped(boolean b)
           
 void setMaxLines(int i)
           
 java.lang.String toString()
          Please override for more interesting output.
 
Methods inherited from class edu.stanford.hci.r3.paper.Region
addEventHandler, getEventHandlers, getFillColor, getHeight, getIsActiveString, getName, getOpacity, getOriginX, getOriginY, getParentSheet, getScaleX, getScaleY, getShape, getStrokeColor, getUnits, getUnscaledBounds2D, getUnscaledBoundsHeight, getUnscaledBoundsWidth, getUnscaledShapeCopy, getWidth, isActive, isVisible, resetScale, scaleRegion, scaleRegionUniformly, setActive, setFillColor, setName, setOpacity, setParentSheet, setScale, setShape, setStrokeColor, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextRegion

public TextRegion(java.lang.String name,
                  java.lang.String theText,
                  java.awt.Font theFont,
                  Units origX,
                  Units origY)
Parameters:
theText - What text is displayed.
theFont - The Font Family. Specify the size in points through the font object. We will consider the point size of the font as an exact 1/72nd of an inch translation, regardless of the device.
origX -
origY -

TextRegion

public TextRegion(java.lang.String name,
                  java.lang.String theText,
                  java.awt.Font theFont,
                  Units origX,
                  Units origY,
                  Units width,
                  Units height)
Parameters:
name -
theText -
theFont -
origX -
origY -
width - override the text's actual width with this value
height - override the text's actual height with this value
Method Detail

getColor

public java.awt.Color getColor()
Returns:

getFont

public java.awt.Font getFont()
Returns:

getLinesOfText

public java.lang.String[] getLinesOfText()
Returns:

getRenderer

public RegionRenderer getRenderer()
Description copied from class: Region
Subclasses should override this, to customize rendering. Otherwise, you'll just get gray boxes, which is what RegionRenderer does.

Overrides:
getRenderer in class Region
Returns:
the renderer for this region
See Also:
Region.getRenderer()

getText

public java.lang.String getText()
Returns:
the internal text to be rendered.

getX

public Units getX()
Returns:

getY

public Units getY()
Returns:

setColor

public void setColor(java.awt.Color c)
Parameters:
c -

setLineWrapped

public void setLineWrapped(boolean b)
Parameters:
b - whether automatic line wrapping should occur. If ture, the text will be constrained to the region boundaries.

isLineWrapped

public boolean isLineWrapped()
Returns:
whether automatic line wrapping should occur. If true, the text will be constrained to the region boundaries.

setMaxLines

public void setMaxLines(int i)
Parameters:
i - the maximum number of lies to set. If <= 0, all lines will be set.

getMaxLines

public int getMaxLines()
Returns:
the maximum number of lines to be set. If <= 0, all lines will be set.

toString

public java.lang.String toString()
Description copied from class: Region
Please override for more interesting output. This will print the name of the class along with all the segments of the shape.

Overrides:
toString in class Region
Returns:
the String representation of this Region
See Also:
Region.toString()

Copyright 2006 Stanford University