cdox.gui
Class StringPlacer

java.lang.Object
  extended bycdox.gui.StringPlacer

public class StringPlacer
extends java.lang.Object

A class to do some calculating on a String used for scrolling on the AboutPane, so that the String always is placed in the middle. This class also stores the position of the String. A call to setHeight sets the current positiont to -1, reset, resets the currentHeight to the original height.

Version:
May 16th 2002
Author:
Rutger Bezema, Andreas Schmitz
See Also:
AboutDialog

Constructor Summary
StringPlacer(java.lang.String na, java.awt.FontMetrics fm, int w, int h, int xL)
          Construct a new StringPlacer Object with given parameters.
 
Method Summary
 int getCenterPosition()
          Returns the x position of the String to center it.
 int getCurrentHeight()
          returns the current position of the text on the backgroundimage.
 java.lang.String getString()
          Returns the String used in this StringPlacer.
 void reset()
          Resets all the standard settings.
 void setCurrentHeight()
          Sets the current y position -1.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringPlacer

public StringPlacer(java.lang.String na,
                    java.awt.FontMetrics fm,
                    int w,
                    int h,
                    int xL)
Construct a new StringPlacer Object with given parameters. It calculates the place on the backgroundImage to draw the given String in the center.

Parameters:
na - the String to do the calculating on,
fm - the FontMetrics with which the text will be drawn, used to calculate the center of the String,
w - the imageWidth,
h - the imageHeight,
xL - the start offset of the nextLines, 0 for first 13 for second, 26.... etc
Method Detail

getCenterPosition

public int getCenterPosition()
Returns the x position of the String to center it.

Returns:
the x poxition of the String.

reset

public void reset()
Resets all the standard settings.


getCurrentHeight

public int getCurrentHeight()
returns the current position of the text on the backgroundimage.

Returns:
the current position of the text.

setCurrentHeight

public void setCurrentHeight()
Sets the current y position -1. For the graphics object to draw this String on has (0,0) in the upper left corner.


getString

public java.lang.String getString()
Returns the String used in this StringPlacer.

Returns:
the String to draw.