com.odesys.chart
Class LabelHelper

java.lang.Object
  |
  +--com.odesys.chart.LabelHelper

public class LabelHelper
extends java.lang.Object

LabelHelper is used internaly to draw the labels of the Charts. The text is drawn at the specified position with the specified alignment. Multiple line text is allowed.


Field Summary
static int BOTTOM
          Constant used to specify alignment to the bottom.
static int CENTER
          Constant used to specify alignment to the center.
static int LEFT
          Constant used to specify alignment to the left.
static int RIGHT
          Constant used to specify alignment to the right.
static int TOP
          Constant used to specify alignment to the top.
 
Constructor Summary
LabelHelper()
          Creates a new LabelHelper instance
LabelHelper(java.lang.String text, int x, int y, int horzAlign, int vertAlign)
          Creates a new LabelHelper instance with the specified text, position and alignment.
 
Method Summary
 int getHorzAlignment()
          Gets the horizontal alignment of this Label
 java.awt.Point getPos()
          Gets the position of the Label.
 java.awt.Dimension getSize(java.awt.FontMetrics fm)
          Calculates the size this LabelHelper based on the specified FontMetrics.
 int getTextAlignment()
          Gets the text alignment of this LabelHelper.
 int getVertAlignment()
          Gets the vertical alignment of this LabelHelper
 void paint(java.awt.Graphics g)
          Draws this LabelHelper in the specified Graphics context.
 void setHorzAlignment(int horzAlign)
          Sets the norizontal alignment of this LabelHelper (e.g.
 void setPos(int x, int y)
          Sets the position of this LabelHelper.
 void setText(java.lang.String text)
          Sets the text of this LabelHelper.
 void setTextAlignment(int textAlign)
          Sets the text alignment inside this LabelHelper.
 void setVertAlignment(int vertAlign)
          Sets the vertical alignment of this LabelHelper (e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT

public static final int LEFT
Constant used to specify alignment to the left.

RIGHT

public static final int RIGHT
Constant used to specify alignment to the right.

TOP

public static final int TOP
Constant used to specify alignment to the top.

BOTTOM

public static final int BOTTOM
Constant used to specify alignment to the bottom.

CENTER

public static final int CENTER
Constant used to specify alignment to the center.
Constructor Detail

LabelHelper

public LabelHelper()
Creates a new LabelHelper instance

LabelHelper

public LabelHelper(java.lang.String text,
                   int x,
                   int y,
                   int horzAlign,
                   int vertAlign)
Creates a new LabelHelper instance with the specified text, position and alignment.
Method Detail

getSize

public java.awt.Dimension getSize(java.awt.FontMetrics fm)
Calculates the size this LabelHelper based on the specified FontMetrics.

paint

public void paint(java.awt.Graphics g)
Draws this LabelHelper in the specified Graphics context.

setText

public void setText(java.lang.String text)
Sets the text of this LabelHelper. Multiple line text is suported.

setPos

public void setPos(int x,
                   int y)
Sets the position of this LabelHelper. The actual appearance of the text depends on the alignment also.

getPos

public java.awt.Point getPos()
Gets the position of the Label.

setHorzAlignment

public void setHorzAlignment(int horzAlign)
Sets the norizontal alignment of this LabelHelper (e.g. if horzAlign is LEFT the label is drawn to the right of the position).

getHorzAlignment

public int getHorzAlignment()
Gets the horizontal alignment of this Label

setVertAlignment

public void setVertAlignment(int vertAlign)
Sets the vertical alignment of this LabelHelper (e.g. if vertAlign is TOP the label is drawn below the position).

getVertAlignment

public int getVertAlignment()
Gets the vertical alignment of this LabelHelper

setTextAlignment

public void setTextAlignment(int textAlign)
Sets the text alignment inside this LabelHelper. The allowed parameters are LEFT, CENTER and RIGHT.

getTextAlignment

public int getTextAlignment()
Gets the text alignment of this LabelHelper.