org.strbio.util.graph
Class ColorScaleLegend

java.lang.Object
  extended by org.strbio.util.graph.ColorScaleLegend
All Implemented Interfaces:
Legend

public class ColorScaleLegend
extends java.lang.Object
implements Legend

A legend for graphs, showing a bar indicating which ColorScale colors correspond to which numeric values.

  Version 1.0, 5/17/99 - adapted from org.strbio.util.BarLegend
  

Version:
1.0, 5/17/99
Author:
JMC

Constructor Summary
ColorScaleLegend(double a, double b, ColorScale c, java.awt.Font f, java.awt.FontMetrics fmet, java.lang.String l, java.lang.String fmt)
          Initialize new legend.
 
Method Summary
 ColorScale getColorScale()
          Return the color scale being used.
 int getHeight()
          Get the height that the legend wants to draw in.
 int getWidth()
          Get the width that the legend wants to draw in.
 void paintLegend(java.awt.Graphics g, int x, int y)
          draw the legend, at a given top, left position.
 void setColorScale(ColorScale x)
          Set the color scale to use.
 void setFont(java.awt.Font f, java.awt.FontMetrics fmet)
          set the font labels will be printed in.
 void setFormat(java.lang.String x)
          Sets the format string for printing min, max; i.e. "%.2f".
 void setLabel(java.lang.String l)
          set the label for this legend.
 void setMinMax(double x, double y)
          Sets the min anx max values for the scale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorScaleLegend

public ColorScaleLegend(double a,
                        double b,
                        ColorScale c,
                        java.awt.Font f,
                        java.awt.FontMetrics fmet,
                        java.lang.String l,
                        java.lang.String fmt)
Initialize new legend.

Method Detail

getColorScale

public ColorScale getColorScale()
Return the color scale being used.


setColorScale

public void setColorScale(ColorScale x)
Set the color scale to use.


setFormat

public void setFormat(java.lang.String x)
Sets the format string for printing min, max; i.e. "%.2f". If null, won't display min and max.


setLabel

public void setLabel(java.lang.String l)
set the label for this legend.

Specified by:
setLabel in interface Legend

setMinMax

public void setMinMax(double x,
                      double y)
Sets the min anx max values for the scale.


setFont

public void setFont(java.awt.Font f,
                    java.awt.FontMetrics fmet)
set the font labels will be printed in.

Specified by:
setFont in interface Legend

getWidth

public int getWidth()
Description copied from interface: Legend
Get the width that the legend wants to draw in.

Specified by:
getWidth in interface Legend

getHeight

public int getHeight()
Description copied from interface: Legend
Get the height that the legend wants to draw in.

Specified by:
getHeight in interface Legend

paintLegend

public void paintLegend(java.awt.Graphics g,
                        int x,
                        int y)
Description copied from interface: Legend
draw the legend, at a given top, left position.

Specified by:
paintLegend in interface Legend