|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opensourcephysics.display.TextLine
public class TextLine
TextLine is designed to bundle together all the information required to draw short Strings with subscripts and superscripts. TextLine was modified by W. Christian to add Greek characters using TeX notation.
Field Summary | |
---|---|
static int |
ALGEBRAIC
Format to use when parsing a double |
static int |
CENTER
Center the Text over the point |
static int |
LEFT
Position the Text to the Left of the point |
static int |
RIGHT
Position the Text to the Right of the point |
static int |
SCIENTIFIC
Format to use when parsing a double |
Constructor Summary | |
---|---|
TextLine()
Instantiate the class |
|
TextLine(java.awt.Font f,
java.awt.Color c,
int j)
Instantiate the class |
|
TextLine(java.lang.String s)
Instantiate the class. |
|
TextLine(java.lang.String s,
java.awt.Color c)
Instantiate the class |
|
TextLine(java.lang.String s,
java.awt.Font f)
Instantiate the class |
|
TextLine(java.lang.String s,
java.awt.Font f,
java.awt.Color c,
int j)
Instantiate the class |
Method Summary | |
---|---|
int |
charWidth(java.awt.Graphics g,
char ch)
|
TextLine |
copyState()
Create a New Textline object copying the state of the existing object into the new one. |
void |
copyState(TextLine t)
Copy the state of the parsed Textline into the existing object. |
void |
drawText(java.awt.Graphics g,
int x,
int y)
Parse the text then draw it without any rotation. |
void |
drawText(java.awt.Graphics g,
int x,
int y,
int j)
Parse the text then draw it. |
int |
getAscent(java.awt.Graphics g)
|
java.awt.Color |
getBackground()
|
java.awt.Color |
getColor()
|
int |
getDescent(java.awt.Graphics g)
|
java.awt.FontMetrics |
getFM(java.awt.Graphics g)
|
java.awt.Font |
getFont()
|
java.lang.String |
getFontName()
|
int |
getFontSize()
|
int |
getFontStyle()
|
int |
getHeight(java.awt.Graphics g)
|
int |
getJustification()
|
int |
getLeading(java.awt.Graphics g)
|
int |
getMaxAscent(java.awt.Graphics g)
|
int |
getMaxDescent(java.awt.Graphics g)
|
java.awt.Font |
getScriptFont(java.awt.Font f)
|
java.awt.geom.Rectangle2D |
getStringBounds(java.awt.Graphics g)
Returns the bounding box for this string. |
java.lang.String |
getText()
|
int |
getWidth(java.awt.Graphics g)
|
boolean |
isNull()
|
static double |
log10(double x)
|
boolean |
parseDouble(double d)
Parse a double value. |
boolean |
parseDouble(double d,
int p)
Parse a double value. |
boolean |
parseDouble(double d,
int n,
int p,
int f)
Parse a double value |
void |
parseText(java.awt.Graphics g)
parse the text. |
void |
setBackground(java.awt.Color c)
Set the Background Color to use with the class |
void |
setColor(java.awt.Color c)
Set the Color to use with the class |
void |
setFont(java.awt.Font f)
Set the Font to use with the class |
void |
setFontName(java.lang.String s)
Set the Logical font name of the current font |
void |
setFontSize(int i)
Set the Font size of the current font |
void |
setFontStyle(int i)
Set the Font style of the current font |
void |
setJustification(int i)
Set the Justification to use with the class |
void |
setText(java.lang.String s)
Set the String to use with the class |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int CENTER
public static final int LEFT
public static final int RIGHT
public static final int SCIENTIFIC
public static final int ALGEBRAIC
Constructor Detail |
---|
public TextLine()
public TextLine(java.lang.String s)
s
- String to parse.public TextLine(java.lang.String s, java.awt.Font f)
s
- String to parse.f
- Font to use.public TextLine(java.lang.String s, java.awt.Font f, java.awt.Color c, int j)
s
- String to parse.f
- Font to use.c
- Color to usej
- Justificationpublic TextLine(java.lang.String s, java.awt.Color c)
s
- String to parse.c
- Color to usepublic TextLine(java.awt.Font f, java.awt.Color c, int j)
f
- Font to use.c
- Color to usej
- JustificationMethod Detail |
---|
public TextLine copyState()
public void copyState(TextLine t)
t
- The TextLine to get the state information from.public void setFont(java.awt.Font f)
f
- Fontpublic void setText(java.lang.String s)
s
- Stringpublic void setColor(java.awt.Color c)
c
- Colorpublic void setBackground(java.awt.Color c)
c
- Colorpublic void setJustification(int i)
i
- Justificationpublic java.awt.Font getFont()
public java.lang.String getText()
public java.awt.Color getColor()
public java.awt.Color getBackground()
public int getJustification()
public java.awt.FontMetrics getFM(java.awt.Graphics g)
g
- Graphics context.
public int charWidth(java.awt.Graphics g, char ch)
g
- Graphics context.ch
- The character.
public java.awt.geom.Rectangle2D getStringBounds(java.awt.Graphics g)
g
- Graphics
public int getWidth(java.awt.Graphics g)
g
- Graphics context.
public int getHeight(java.awt.Graphics g)
g
- Graphics context.
public int getAscent(java.awt.Graphics g)
g
- Graphics context.
public int getMaxAscent(java.awt.Graphics g)
g
- Graphics context.
public int getDescent(java.awt.Graphics g)
g
- Graphics context.
public int getMaxDescent(java.awt.Graphics g)
g
- Graphics context.
public int getLeading(java.awt.Graphics g)
g
- Graphics context.
public void parseText(java.awt.Graphics g)
g
- Graphics context.public boolean isNull()
public void drawText(java.awt.Graphics g, int x, int y, int j)
g
- Graphics contextx
- pixel position of the texty
- pixel position of the textj
- justification of the textpublic void drawText(java.awt.Graphics g, int x, int y)
g
- Graphics contextx
- pixel position of the texty
- pixel position of the textpublic java.lang.String getFontName()
public int getFontStyle()
public int getFontSize()
public void setFontName(java.lang.String s)
s
- Logical font name.public void setFontStyle(int i)
i
- Font style.public void setFontSize(int i)
i
- Font size.public java.awt.Font getScriptFont(java.awt.Font f)
f
- Font
public boolean parseDouble(double d)
d
- double to parse
return true if the parse was successfulpublic boolean parseDouble(double d, int p)
d
- double to parsep
- precision of the number
return true if the parse was successfulpublic boolean parseDouble(double d, int n, int p, int f)
d
- double to parsen
- number of significant figuresp
- precision of the numberf
- format of the number scientific, algebraic etc.
return true if the parse was successfulpublic static double log10(double x) throws java.lang.ArithmeticException
x
- a double value
java.lang.ArithmeticException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |