net.sourceforge.chart2d
Class TextArea

java.lang.Object
  |
  +--net.sourceforge.chart2d.Area
        |
        +--net.sourceforge.chart2d.FontArea
              |
              +--net.sourceforge.chart2d.TextArea

class TextArea
extends FontArea

A customizable text label. This label has built-int bordering, spacing between borders and text, text rotation, line breaking, auto justification within the borders, growing and shrinking, and auto locating. Much of this functionality is provided by its super classes.
Note: Does not support null values. Pass empty strings instead.


Fields inherited from class net.sourceforge.chart2d.Area
BETWEEN, BOTTOM, CENTER, CENTERED, CONTINUOUS, DASHED, DOTTED, FLOAT, HEIGHT, HORIZONTAL, INTEGER, LABELSBOTTOM, LABELSLEFT, LEFT, LEFTBOTTOM, LEFTRIGHT, LEFTTOP, LESSER, MAX, MAXMODEL, MIN, RIGHT, RIGHTBOTTOM, RIGHTTOP, TOP, TOPBOTTOM, VERTICAL, WIDTH
 
Constructor Summary
(package private) TextArea()
          Creates a new text area with the following default values: setText ("");
setRotateLeft (false);
setTextJustification (CENTER);
resetTextAreaModel (true);
 
Method Summary
(package private)  boolean getRotateLeft()
          Returns whether this text is rotated left 90 degrees.
(package private)  java.lang.String getText()
          Returns the text of this label.
(package private)  boolean getTextAreaNeedsUpdate()
          Indicates whether some property of this class has changed.
(package private)  void paintComponent(java.awt.Graphics2D g2D)
          Paints all of the components of this class.
(package private)  void resetTextAreaModel(boolean reset)
          Resets the model for this class.
(package private)  void setRotateLeft(boolean r)
          Adjusts the rotation of the text within the label.
(package private)  void setText(java.lang.String t)
          Changes the text of this label.
(package private)  void setTextJustification(int which)
          Specifies whether text will be (in the case text is not rotated) left, right, or center justified respective to the space within the bordered area.
(package private)  void updateTextArea(java.awt.Graphics2D g2D)
          Updates all the variables of all this parent's classes, then all the variables of this class.
 
Methods inherited from class net.sourceforge.chart2d.FontArea
getFont, getFontAreaNeedsUpdate, getFontColor, getFontName, getFontPointModel, getFontStyle, resetFontAreaModel, setFontColor, setFontName, setFontPointModel, setFontStyle, updateFontArea
 
Methods inherited from class net.sourceforge.chart2d.Area
applyRatio, getAreaNeedsUpdate, getAutoSize, getBackgroundColor, getBackgroundExistence, getBorderColor, getBorderColor, getBorderExistence, getBorderExistence, getBorderThickness, getBorderThickness, getBorderThicknessModel, getBorderThicknessModel, getGapThickness, getGapThicknessModel, getJustifications, getRatio, getResetAreaModel, getSize, getSizeLocation, getSpaceSize, getSpaceSizeLocation, resetAreaModel, setAutoJustifys, setAutoSizes, setBackgroundColor, setBackgroundExistence, setBorderAssociations, setBorderColor, setBorderColors, setBorderCornerAssociations, setBorderExistence, setBorderExistences, setBorderThicknessModel, setBorderThicknessModels, setCustomRatio, setGapAssociations, setGapExistence, setGapExistences, setGapThicknessModel, setGapThicknessModels, setJustifications, setLockRatios, setSize, setSizeLocation, setSpaceSize, setSpaceSizeLocation, updateArea
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextArea

TextArea()
Creates a new text area with the following default values: setText ("");
setRotateLeft (false);
setTextJustification (CENTER);
resetTextAreaModel (true);
Method Detail

setText

void setText(java.lang.String t)
Changes the text of this label.
Parameters:
t - The new text.

setRotateLeft

void setRotateLeft(boolean r)
Adjusts the rotation of the text within the label. If not rotated, text runs from left to right, top to bottom of the are. If rotate, text runs from bottom to top, left to right. The text is rotated -90 degree. Even when rotate, the location or origin of this label is always the top left corner of it, however, the text's actual origin is near the bottom left corner.
Parameters:
r - If true, then adjusts settings so that text is rotated.

setTextJustification

void setTextJustification(int which)
Specifies whether text will be (in the case text is not rotated) left, right, or center justified respective to the space within the bordered area. In the case text is rotated, then bottom, top or center justification is available. This only adjusts the horizontal justification, or in the case of rotated text, the vertical justification.
Parameters:
which - Which justification for the text. Possible values, if not rotated: LEFT, RIGHT, CENTER; if rotated: BOTTOM, TOP, CENTER. Also, if you prefer and when rotated, LEFT and RIGHT may be used to mean BOTTOM and TOP respectively; this program translates them into BOTTOM and TOP for you.

getText

java.lang.String getText()
Returns the text of this label.
Returns:
The label's text.

getRotateLeft

boolean getRotateLeft()
Returns whether this text is rotated left 90 degrees.
Returns:
If rotated, then true.

getTextAreaNeedsUpdate

boolean getTextAreaNeedsUpdate()
Indicates whether some property of this class has changed.
Returns:
True if some property has changed.

updateTextArea

void updateTextArea(java.awt.Graphics2D g2D)
Updates all the variables of all this parent's classes, then all the variables of this class.
Parameters:
g2D - The graphics context under which to make calculations.

resetTextAreaModel

void resetTextAreaModel(boolean reset)
Resets the model for this class. The model is used for shrinking and growing of its components based on the maximum size of this class. If this method is called, then the next time the maximum size is set, this classes model maximum size will be made equal to the new maximum size. Effectively what this does is ensure that whenever this objects maximum size is equal to the one given, then all of the components will take on their default model sizes. Note: This is only useful when auto model max sizing is disabled.
Parameters:
reset - True causes the max model size to be set upon the next max sizing.

paintComponent

void paintComponent(java.awt.Graphics2D g2D)
Paints all of the components of this class. First all the variables are updated. Then all the components are painted.
Overrides:
paintComponent in class FontArea
Parameters:
g2D - The graphics context for calculations and painting.