net.sourceforge.chart2d
Class LegendArea

java.lang.Object
  |
  +--net.sourceforge.chart2d.Area
        |
        +--net.sourceforge.chart2d.FontArea
              |
              +--net.sourceforge.chart2d.TextListArea
                    |
                    +--net.sourceforge.chart2d.VerticalTextListArea
                          |
                          +--net.sourceforge.chart2d.LegendArea

class LegendArea
extends VerticalTextListArea

A customizable legend for a chart, enabling charting of multiple data sets.

Features:
Supports any number of text labels, allows for associating of any color with any text label. Includes bordering, gapping, auto and manual resizing and locating, and growing and shrinking components. The only shape of bullet that is available is a rectangle, however.


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) LegendArea()
          Creates a legend area using all the defaults of vertical text list area.
 
Method Summary
(package private)  boolean getLegendAreaNeedsUpdate()
          Indicates whether some property of this class has changed.
(package private)  void paintComponent(java.awt.Graphics2D g2D)
          Paints all the components of this class.
(package private)  void resetLegendAreaModel(boolean reset)
          Resets the model for this class.
(package private)  void setColors(java.awt.Color[] colors)
          Specifies which colors to use for the label's bullets.
(package private)  void updateLegendArea(java.awt.Graphics2D g2D)
          Updates all variables.
 
Methods inherited from class net.sourceforge.chart2d.VerticalTextListArea
getBetweenBulletsAndLabelsGapThicknessModel, getBetweenBulletsGapThicknessModel, getBetweenLabelsGapThicknessModel, getBulletColors, getBullets, getBulletsAlignment, getBulletsOutline, getBulletsOutlineColor, getBulletsSizeModel, getLabels, getLabelsExistence, getLabelStrings, getNumBullets, getVerticalTextListAreaNeedsUpdate, resetVerticalTextListAreaModel, setAllowSelfSize, setBetweenBulletsAndLabelsGapExistence, setBetweenBulletsAndLabelsGapThicknessModel, setBetweenBulletsGapExistence, setBetweenBulletsGapThicknessModel, setBetweenLabelsGapExistence, setBetweenLabelsGapThicknessModel, setBulletColors, setBulletsAlignment, setBulletsOutline, setBulletsOutlineColor, setBulletsRelation, setBulletsSizeModel, setCustomSpaceMinHeight, setLabels, setLabelsExistence, updateVerticalTextListArea
 
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

LegendArea

LegendArea()
Creates a legend area using all the defaults of vertical text list area. Defaults:
setAutoSizes (false, false);
setAutoJustifys (false, false);
resetLegendAreaModel (true);
Method Detail

setColors

void setColors(java.awt.Color[] colors)
Specifies which colors to use for the label's bullets. Each label has a bullet to its left. This method sets the colors for these bullets. The uppermost label will get the lowest order array member.
Parameters:
colors - The bullet colors.

resetLegendAreaModel

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

getLegendAreaNeedsUpdate

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

updateLegendArea

void updateLegendArea(java.awt.Graphics2D g2D)
Updates all variables. First updates the variables of its parent class, then updates its own variables.
Parameters:
g2D - The graphics context used for calculations.

paintComponent

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