|
Oracle JEWT API Reference Release 4.2.33.0.0 B12199-01 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--oracle.bali.ewt.text.WrappedText
Utility class for wrapping text.
Clients can create WrappedText objects that encapsulate a wrapped form of a string. This class also offers static utility methods that will perform the wrapping, then return a single String with newlines inserted as needed to wrap the text.
Clients can optionally use the "forceFit" option; when true, word-wrapping will break words too long to fit within the allowed width on character boundaries. In all cases, this option defaults to false unless explicitly set as true.
| Constructor Summary | |
WrappedText(java.lang.String text,
TextWrapper wrapper,
java.awt.Component component)
Creates a WrappedText object encapsulating the wrapped form of the given string, when wrapped inside the component. |
|
WrappedText(java.lang.String text,
TextWrapper wrapper,
java.awt.Component component,
boolean forceFit)
Creates a WrappedText object encapsulating the wrapped form of the given string. |
|
WrappedText(java.lang.String text,
TextWrapper wrapper,
int width,
java.awt.FontMetrics metrics,
java.util.Locale locale,
boolean forceFit)
Creates a WrappedText object encapsulating the wrapped form of the given string. |
|
| Method Summary | |
boolean |
addLine(java.lang.String text,
int start,
int end)
A callback - do not call directly. |
java.awt.FontMetrics |
getFontMetrics()
Returns the FontMetrics the TextWrapper should use when measuring text. |
java.lang.String |
getLine(int index)
Returns a line of wrapped text, not including any newlines. |
int |
getLineCount()
Returns the number of lines of text needed. |
java.util.Locale |
getLocale()
Returns the locale to use when wrapping text. |
java.lang.String |
getText()
Returns the (unwrapped) string. |
java.lang.String |
getWrappedText()
Returns a wrapped version of the string, with newlines inserted. |
int |
getWrapWidth()
Returns the wrapping point at which the TextWrapper should wrap the text. |
boolean |
isCalculatingPreferred()
Returns true if the TextWrapper should wrap optimally, false if it should try to force the words to fit in the wrap width. |
static java.lang.String |
wrapText(java.lang.String text,
java.awt.Component component)
Given a string, will add newlines to it to word-wrap within the width of the provided component, using that component's font and locale. |
static java.lang.String |
wrapText(java.lang.String text,
TextWrapper wrapper,
java.awt.Component component)
Given a string, will add newlines to it to wrap within the width of the provided component, using that component's font and locale, and the specified text wrapper algorithm. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public WrappedText(java.lang.String text,
TextWrapper wrapper,
java.awt.Component component)
text - a string to wrapwrapper - the wrapping algorithm to usecomponent - the component to wrap in
public WrappedText(java.lang.String text,
TextWrapper wrapper,
java.awt.Component component,
boolean forceFit)
text - a string to wrapwrapper - the wrapping algorithm to usecomponent - the component to wrap inforceFit - should text be forced to fit within the width,
or be allowed to extend outside the width
public WrappedText(java.lang.String text,
TextWrapper wrapper,
int width,
java.awt.FontMetrics metrics,
java.util.Locale locale,
boolean forceFit)
text - a string to wrapwrapper - the wrapping algorithm to usewidth - the width in which to wrap the textmetrics - the font metrics for measuring the textlocale - the locale for the wrapping algortihm; if null
uses the user's default localeforceFit - should text be forced to fit within the width,
or be allowed to extend outside the width| Method Detail |
public static java.lang.String wrapText(java.lang.String text,
java.awt.Component component)
text - a string to wrapcomponent - the component to wrap in
public static java.lang.String wrapText(java.lang.String text,
TextWrapper wrapper,
java.awt.Component component)
text - a string to wrapwrapper - the wrapping algorithm to usecomponent - the component to wrap inpublic java.lang.String getText()
public java.lang.String getWrappedText()
public int getLineCount()
public java.lang.String getLine(int index)
index - the zero-based index
public boolean addLine(java.lang.String text,
int start,
int end)
addLine in interface WrapInfooracle.bali.ewt.text.WrapInfotext - the text being wrappedstartOfLine - the index of the start of the next lineendOfLine - the index of the end of the next linepublic boolean isCalculatingPreferred()
isCalculatingPreferred in interface WrapInfopublic java.awt.FontMetrics getFontMetrics()
getFontMetrics in interface WrapInfopublic java.util.Locale getLocale()
getLocale in interface WrapInfopublic int getWrapWidth()
getWrapWidth in interface WrapInfo
|
Oracle JEWT 4.2.33 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||