|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.toolbox.rebop.FormattedText
Represents a "run" of text with a single set of style attributes. Includes logic for word-wrapping the text within a given area.
StyledText
Field Summary | |
static String |
versionId
|
Constructor Summary | |
FormattedText()
|
|
FormattedText(Font font,
Color color,
String string)
Creates a new FormattedText instance. |
|
FormattedText(String text)
|
Method Summary | |
void |
draw(Graphics g,
int x,
int y,
int width,
int height)
Allows a FormattedText object to be used as a component's Drawable object. |
static void |
drawWrappedText(Graphics g,
String text,
Dimension size,
int leftMargin,
boolean measureOnly,
Point startPoint,
Dimension preferredDimension,
Vector wrappedRuns)
Draws and/or measures text wrapped within a set of constraints. |
Color |
getColor()
|
Font |
getFont()
|
String |
getString()
|
void |
setColor(Color color)
|
void |
setFont(Font font)
|
void |
setString(String string)
|
void |
updateGraphics(Graphics g)
Updates a Graphics object with font and color, if set |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String versionId
Constructor Detail |
public FormattedText()
public FormattedText(String text)
public FormattedText(Font font, Color color, String string)
FormattedText
instance.
font
- Text will be drawn using this font, or
the current font of the passed-in Graphics object if
font is set to null.color
- Text will be drawn in this color, or
the current color of the passed-in Graphics object if
color is set to null.string
- Text to drawMethod Detail |
public void updateGraphics(Graphics g)
g
- Graphics to updatepublic String getString()
public void setString(String string)
public Font getFont()
public void setFont(Font font)
public Color getColor()
public void setColor(Color color)
public void draw(Graphics g, int x, int y, int width, int height)
public static void drawWrappedText(Graphics g, String text, Dimension size, int leftMargin, boolean measureOnly, Point startPoint, Dimension preferredDimension, Vector wrappedRuns)
g
- Graphics context to draw the wrapped text upon.text
- to drawsize
- text will be wrapped within the width of this Dimension.
Text will not be drawn below the bottom of this size, but if the
measureOnly flag is set, the max height WILL be calculated.leftMargin
- new lines after the first line will begin at this
horizontal offset in the current coordinate system.startPoint
- The location in the current coordinate system to
begin drawing the first line of textpreferredDimension
- @out if all the text were to be drawn, this
dimension would be required to hold it. Only valid if measureOnly is set.measureOnly
- if true, calculate preferredDimension but do not draw.wrappedRuns
- if non-null, store cached runs here
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |