|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object acm.util.JTFTools
public class JTFTools
This class provides a collection of static utility methods that are used elsewhere in the ACM packages.
Method Summary | |
---|---|
void |
copyBytes(InputStream in,
OutputStream out,
long nBytes)
|
void |
copyFile(File oldFile,
File newFile)
oldFile to newFile . |
Container |
createEmptyContainer()
|
Color |
decodeColor(String name)
|
Font |
decodeFont(String str)
Font.decode . |
Font |
decodeFont(String str,
Font oldFont)
Font.decode . |
String |
findFontFamily(String str)
str that exists in
the current GraphicsEnvironment . |
Frame |
getEnclosingFrame(Component comp)
|
String[] |
getFontList()
|
Font |
getStandardFont(Font font)
|
boolean |
matchFilenamePattern(String filename,
String pattern)
|
void |
pause(double milliseconds)
|
Method Detail |
---|
public static void copyBytes(InputStream in,
OutputStream out,
long nBytes)
throws IOException
Parameters: |
|
IOException
public static void copyFile(File oldFile,
File newFile)
oldFile
to newFile
.
Usage: | JTFTools.copyFile(oldFile, newFile); | ||||
Parameters: |
|
public static Container createEmptyContainer()
Usage: | Container comp = JTFTools.createEmptyContainer(); |
Returns: | An empty lightweight container that can be used as a placeholder |
public static Color decodeColor(String name)
Color.decode
except in that it allows named colors and system colors.
Usage: | color = JTFTools.decodeColor(name); | ||
Parameter: |
| ||
Returns: | The color corresponding to the specified name |
public static Font decodeFont(String str)
Font.decode
.
Usage: | Font font = JTFTools.decodeFont(str); | ||
Parameter: |
| ||
Returns: | The new font |
public static Font decodeFont(String str,
Font oldFont)
Font.decode
. The only difference
is that this method takes a font parameter that gives default values for
the different parts of the font. If the family, size, or style is specified
as an asterisk, the corresponding value is taken from the supplied font.
Usage: | Font font = JTFTools.decodeFont(str, oldFont); | ||||
Parameters: |
| ||||
Returns: | The new font |
public static String findFontFamily(String str)
str
that exists in
the current GraphicsEnvironment
. As in HTML font tags, the
str
consists of a set of font names separated by semicolons.
The findFontFamily
method returns the first family name that
exists in the list of loaded fonts, or null
if there are none.
Usage: | String familyName = JTFTools.findFontFamily(str); | ||
Parameter: |
| ||
Returns: | The first family name that exists, or null if none
|
public static Frame getEnclosingFrame(Component comp)
Usage: | Frame frame = JTFTools.getEnclosingFrame(comp); | ||
Parameter: |
| ||
Returns: | The nearest enclosing Frame object
|
public static String[] getFontList()
Usage: | String[] fonts = JTFTools.getFontList(); |
Returns: | An array of the available font family names |
public static Font getStandardFont(Font font)
Serif
, SansSerif
, and Monospaced
.
Usage: | Font newFont = JTFTools.getStandardFont(font); | ||
Parameter: |
| ||
Returns: | The new font |
public static boolean matchFilenamePattern(String filename,
String pattern)
? | Matches any single character |
* | Matches any sequence of characters |
[...] | Matches any of the specified characters |
[^...] | Matches any character except the specified ones |
a-z
.
Usage: | if (JTFTools.matchFilenamePattern(filename, pattern)) . . . | ||||
Parameters: |
| ||||
Returns: | true if the filename matches the pattern
|
public static void pause(double milliseconds)
Thread.sleep
, this method never throws an
exception.
Usage: | JTFTools.pause(milliseconds); | ||
Parameter: |
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |