public class TextUtilities
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static TextUtilities |
INSTANCE
a singleton default instance
|
Constructor and Description |
---|
TextUtilities() |
Modifier and Type | Method and Description |
---|---|
int |
getAscent(Font font)
Gets the font's ascent.
|
int |
getDescent(Font font)
Gets the font's descent.
|
int |
getLargestSubstringConfinedTo(java.lang.String s,
Font f,
int availableWidth)
Returns the largest substring of s in Font f that can be
confined to the number of pixels in availableWidth.
|
Dimension |
getStringExtents(java.lang.String s,
Font f)
Returns the Dimensions of s in Font f.
|
Dimension |
getTextExtents(java.lang.String s,
Font f)
Returns the Dimensions of the given text, converting newlines and tabs
appropriately.
|
public static TextUtilities INSTANCE
public Dimension getStringExtents(java.lang.String s, Font f)
s
- the stringf
- the fontpublic Dimension getTextExtents(java.lang.String s, Font f)
s
- the textf
- the fontpublic int getAscent(Font font)
font
- public int getDescent(Font font)
font
- public int getLargestSubstringConfinedTo(java.lang.String s, Font f, int availableWidth)
s
- the original stringf
- the fontavailableWidth
- the available widthCopyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.