net.sourceforge.chart2d
Class FontArea

java.lang.Object
  |
  +--net.sourceforge.chart2d.Area
        |
        +--net.sourceforge.chart2d.FontArea
Direct Known Subclasses:
PieLabelsArea, TextArea, TextListArea, TitledArea

class FontArea
extends Area

Maintains a font to be used within an area. Contains all variables for the font, such as point, name, style, and color. Builds a font from these variable. When building font, uses the lesser ratio of the area class. This ensures proper growing and shrinking of the font respective to the changing in the area's size. Grows and shrinks if and only if max model area auto size is disabled.


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) FontArea()
          Builds a new FontArea with the default values.
 
Method Summary
(package private)  java.awt.Font getFont()
          Returns a font built from the present variable values.
(package private)  boolean getFontAreaNeedsUpdate()
          Indicates whether some property of this class has changed.
(package private)  java.awt.Color getFontColor()
          Returns this font's color.
(package private)  java.lang.String getFontName()
          Returns the name of this font.
(package private)  int getFontPointModel()
          Returns the model font's point; not the actual font point.
(package private)  int getFontStyle()
          Returns the style of this font.
(package private)  void paintComponent(java.awt.Graphics2D g2D)
          Paints this class.
(package private)  void resetFontAreaModel(boolean reset)
          Resets the model for this class.
(package private)  void setFontColor(java.awt.Color c)
          Changes the color of this font.
(package private)  void setFontName(java.lang.String n)
          Changes the name of this font.
(package private)  void setFontPointModel(int p)
          Changes the model font's point size.
(package private)  void setFontStyle(int s)
          Changes the style of this font.
(package private)  void updateFontArea()
          Updates all this classes variables.
 
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

FontArea

FontArea()
Builds a new FontArea with the default values.
Method Detail

setFontPointModel

void setFontPointModel(int p)
Changes the model font's point size. This is the size that the font would be if the maximum size of the area was equal to the model size of the area. Otherwise, a ratio based on maximum size / model size is taken and applied to this point, producing the actual font point.
Parameters:
p - The new model font point.

setFontName

void setFontName(java.lang.String n)
Changes the name of this font. This accepts the same values as the Font classes constructor Font (String name, int style, int point).
Parameters:
n - Then new name of the font.

setFontStyle

void setFontStyle(int s)
Changes the style of this font. This accepts the same values as the Font classes constructor Font (String name, int style, int point).
Parameters:
s - Then new style of the font.

setFontColor

void setFontColor(java.awt.Color c)
Changes the color of this font. This accepts all Color.* compatible values.
Parameters:
c - Then new color of the font.

getFontPointModel

int getFontPointModel()
Returns the model font's point; not the actual font point.
Returns:
The model font's point.

getFontName

java.lang.String getFontName()
Returns the name of this font.
Returns:
Then name of the font.

getFontStyle

int getFontStyle()
Returns the style of this font.
Returns:
Then style of the font.

getFontColor

java.awt.Color getFontColor()
Returns this font's color.
Returns:
This font's color.

getFont

java.awt.Font getFont()
Returns a font built from the present variable values. Updates the font point based on the model font point, builds an font, and return it.
Returns:
The current font.

getFontAreaNeedsUpdate

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

resetFontAreaModel

void resetFontAreaModel(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.

updateFontArea

void updateFontArea()
Updates all this classes variables. First updates it's parent class, then then updates its own variables.

paintComponent

void paintComponent(java.awt.Graphics2D g2D)
Paints this class. Updates all variables, then paints its parent, since this class itself doesn't have anything to paint.
Overrides:
paintComponent in class Area
Parameters:
g2D - The graphics context for calculations and painting.