Class GraphLabel

java.lang.Object
  |
  +--GraphLabel

class GraphLabel
extends java.lang.Object

Represents a multi-line graph label.


Field Summary
protected  java.lang.String[] lines
           
 
Constructor Summary
GraphLabel(java.lang.String s)
          Creates a new label.
 
Method Summary
 int countLines()
          Calculates the number of (textual) lines occupied by this label.
 int getHeight(java.awt.FontMetrics fm)
          Calculates the height (in pixels) of this label.
 int getWidth(java.awt.FontMetrics fm)
          Calculates the width (in pixels) of this label.
 void paint(java.awt.Graphics g, int x, int y)
          Paints this label such that the top-left corner of the label lies at the specified point
 void paintBelow(java.awt.Graphics g, int x, int y)
          Paints this label below the specified point, centered horizontally.
 void paintToLeft(java.awt.Graphics g, int x, int y)
          Paints this label to the left of the specified point, centered vertically.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

lines

protected java.lang.String[] lines
Constructor Detail

GraphLabel

public GraphLabel(java.lang.String s)
Creates a new label. To have the label span several lines, insert LF characters ('\n') to create line breaks.
Parameters:
s - The text for the label
Method Detail

getWidth

public int getWidth(java.awt.FontMetrics fm)
Calculates the width (in pixels) of this label.
Parameters:
fm - The FontMetrics with which the label will be rendered

getHeight

public int getHeight(java.awt.FontMetrics fm)
Calculates the height (in pixels) of this label.
Parameters:
fm - The FontMetrics with which the label will be rendered

paintToLeft

public void paintToLeft(java.awt.Graphics g,
                        int x,
                        int y)
Paints this label to the left of the specified point, centered vertically.

paintBelow

public void paintBelow(java.awt.Graphics g,
                       int x,
                       int y)
Paints this label below the specified point, centered horizontally.

paint

public void paint(java.awt.Graphics g,
                  int x,
                  int y)
Paints this label such that the top-left corner of the label lies at the specified point

countLines

public int countLines()
Calculates the number of (textual) lines occupied by this label.