org.opensourcephysics.display
Class TitleText

java.lang.Object
  extended by org.opensourcephysics.display.TextLine
      extended by org.opensourcephysics.display.DrawableTextLine
          extended by org.opensourcephysics.display.TitleText
All Implemented Interfaces:
Drawable

public class TitleText
extends DrawableTextLine

A text line that is offset relative to a drawing panel's display area.

Version:
1.0
Author:
Wolfgang Christian

Field Summary
static int BOTTOM
           
static int CENTER
           
static int CUSTOM
           
static int LEFT
           
static int RIGHT
           
static int TOP
           
 
Fields inherited from class org.opensourcephysics.display.TextLine
ALGEBRAIC, SCIENTIFIC
 
Constructor Summary
TitleText(java.lang.String text)
          TitleText draws a TextLine relative to a drawing panel's edge.
 
Method Summary
 void draw(DrawingPanel panel, java.awt.Graphics g)
          Draws the TextLine offset from the location.
 void setFont(java.awt.Font font)
          Sets the font used to display the text.
 void setLocation(int location)
          Sets the location of the text relative to a display area edge
 void setOffsets(int xoff, int yoff)
          Sets the x and y offsets.
 void setText(java.lang.String text)
          Sets the text to be displayed.
 
Methods inherited from class org.opensourcephysics.display.DrawableTextLine
getLoader, getX, getY, setPixelXY, setTheta, setX, setY
 
Methods inherited from class org.opensourcephysics.display.TextLine
charWidth, copyState, copyState, drawText, drawText, getAscent, getBackground, getColor, getDescent, getFM, getFont, getFontName, getFontSize, getFontStyle, getHeight, getJustification, getLeading, getMaxAscent, getMaxDescent, getScriptFont, getStringBounds, getText, getWidth, isNull, log10, parseDouble, parseDouble, parseDouble, parseText, setBackground, setColor, setFontName, setFontSize, setFontStyle, setJustification
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CENTER

public static final int CENTER
See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
See Also:
Constant Field Values

LEFT

public static final int LEFT
See Also:
Constant Field Values

TOP

public static final int TOP
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values

CUSTOM

public static final int CUSTOM
See Also:
Constant Field Values
Constructor Detail

TitleText

public TitleText(java.lang.String text)
TitleText draws a TextLine relative to a drawing panel's edge.

Parameters:
text - String
Method Detail

setOffsets

public void setOffsets(int xoff,
                       int yoff)
Sets the x and y offsets.

Parameters:
xoff - double
yoff - double

setLocation

public void setLocation(int location)
Sets the location of the text relative to a display area edge

Parameters:
location - int

setFont

public void setFont(java.awt.Font font)
Sets the font used to display the text.

Overrides:
setFont in class TextLine
Parameters:
font - Font

setText

public void setText(java.lang.String text)
Sets the text to be displayed.

Overrides:
setText in class TextLine
Parameters:
text - String

draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics g)
Draws the TextLine offset from the location.

Specified by:
draw in interface Drawable
Overrides:
draw in class DrawableTextLine
Parameters:
panel - DrawingPanel
g - Graphics