Fairness.Graphing
Class LegendItem

java.lang.Object
  extended by Fairness.Graphing.LegendItem
All Implemented Interfaces:
edu.rit.swing.Displayable, edu.rit.swing.Drawable

public class LegendItem
extends java.lang.Object
implements edu.rit.swing.Displayable

LegendItem draws a single piece of a graph's legend by drawing a dot with a label.


Constructor Summary
LegendItem(Fairness.Graphing.PlotSeriesInfo info, java.lang.String name)
          Constructs a new LegendItem to display a legend fragment for a series to be drawn with the given PlotSeriesInfo and the name of the series.
 
Method Summary
 void draw(java.awt.Graphics2D g2d)
          Draw this drawable object in the given graphics context.
 java.awt.Paint getBackgroundPaint()
          Returns this displayable object's background paint.
 java.awt.geom.Rectangle2D getBoundingBox()
          Returns this displayable object's bounding box.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LegendItem

public LegendItem(Fairness.Graphing.PlotSeriesInfo info,
                  java.lang.String name)
Constructs a new LegendItem to display a legend fragment for a series to be drawn with the given PlotSeriesInfo and the name of the series.

Parameters:
info - non-null PlotSeriesInfo
name - non-null name
Method Detail

getBoundingBox

public java.awt.geom.Rectangle2D getBoundingBox()
Returns this displayable object's bounding box. This is the smallest rectangle that encloses all of this displayable object.

Currently this is hardcoded because we can't tell how big the label will be.

Specified by:
getBoundingBox in interface edu.rit.swing.Displayable

getBackgroundPaint

public java.awt.Paint getBackgroundPaint()
Returns this displayable object's background paint.

Specified by:
getBackgroundPaint in interface edu.rit.swing.Displayable

draw

public void draw(java.awt.Graphics2D g2d)
Draw this drawable object in the given graphics context. Upon return from this method, the given graphics context's state (color, font, transform, clip, and so on) is the same as it was upon entry to this method.

Specified by:
draw in interface edu.rit.swing.Drawable
Parameters:
g2d - 2-D graphics context.