org.opensourcephysics.display
Class TitleText
java.lang.Object
org.opensourcephysics.display.TextLine
org.opensourcephysics.display.DrawableTextLine
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
Fields inherited from class org.opensourcephysics.display.TextLine |
ALGEBRAIC, ascent, background, color, descent, font, fontname, fontsize, fontstyle, height, justification, leading, lg, list, maxAscent, maxDescent, parse, SCIENTIFIC, script_fraction, sub_offset, sup_offset, text, width |
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.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 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
TitleText
public TitleText(java.lang.String text)
- TitleText draws a TextLine relative to a drawing panel's edge.
- Parameters:
text
- String
setOffsets
public void setOffsets(int xoff,
int yoff)
- Sets the x and y offsets.
- Parameters:
xoff
- doubleyoff
- 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
- DrawingPanelg
- Graphics