|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
This interface defines a generic interface for objects that can measure and display strings. It is expected that implementers will determine what to do with special characters, wrapping, etc. This should be used when wanting a bit more intelligence than FontMetrics.stringWidth() and Graphics.drawString() offer. In addition to some basic protocols, a variety of flags are offered which may somehow be associated with special characters to give implementers help in determining what to do when those characters are discovered and offer implementers the opportunity to avoid hard coding based on particular characters in a "standard" way.
| Field Summary | |
static int |
BREAK
Encourage new lines if later non-special characters would otherwise end up past some maximum x coordinate. |
static int |
BREAK_AFTER
Encourage new lines after these characters if later non-special characters would otherwise end up past some maximum x coordinate. |
static int |
BREAK_BEFORE
Encourage new lines before these characters if later non-special characters would otherwise end up past some maximum x coordinate. |
static int |
END_ABSORB
Ignore (with respect to wrapping) these characters at the end of lines and avoid using them at the beginning of a line unless preceded by a NEW_LINE. |
static int |
END_DELAY
These characters force some vertical movement. |
static int |
NEW_LINE
These characters force the character which immediately follows them to appear on a new line. |
static int |
NO_FONT
These characters are not displayed based on what the font says, but rather some sort of special handling. |
static int |
VERTICAL
These characters force some vertical movement. |
static int |
VERTICAL_MOVE
These characters force some manual vertical movement more complicated than a simple NEW_LINE. |
| Method Summary | |
java.awt.Font |
getFont()
Answer the font the receiver is using. |
java.lang.String[] |
getRawStringLines()
Answers an array of the substrings, one for each line. |
java.lang.String |
getString()
Answer the String the receiver is associated with. |
int |
getStringHeight()
Answer the height of the composed string. |
java.lang.String[] |
getStringLines()
Answers an array of the substrings, one for each line. |
int |
getStringWidth()
Answer the width of the composed string. |
void |
paint(java.awt.Graphics g)
Paints the string. |
void |
paint(java.awt.Graphics g,
int x,
int y)
Paints the string starting at the top left specified. |
void |
setFont(java.awt.Font font)
Set the receiver up to compose and display based on the given font. |
void |
setString(java.lang.String newString)
Set the receiver up to display the string. |
| Field Detail |
public static final int BREAK_AFTER
public static final int BREAK_BEFORE
public static final int BREAK
public static final int END_ABSORB
public static final int NO_FONT
public static final int NEW_LINE
public static final int VERTICAL_MOVE
public static final int VERTICAL
public static final int END_DELAY
| Method Detail |
public java.awt.Font getFont()
public java.lang.String[] getRawStringLines()
public java.lang.String getString()
public int getStringHeight()
public java.lang.String[] getStringLines()
public int getStringWidth()
public void paint(java.awt.Graphics g)
g - the specified Graphics window.
public void paint(java.awt.Graphics g,
int x,
int y)
g - the specified Graphics window.x - the x coordinate to display the leftmost point.y - the y coordinate to display the topmost point.public void setFont(java.awt.Font font)
font - the font to use as a base.public void setString(java.lang.String newString)
string - the string to use as a base.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||