public class Utility
extends java.lang.Object
| Constructor and Description |
|---|
Utility() |
| Modifier and Type | Method and Description |
|---|---|
static MediaLocator |
appArgToMediaLocator(java.lang.String arg)
Converts a string to a URL.
|
static MediaLocator |
appletArgToMediaLocator(java.applet.Applet applet,
java.lang.String arg)
Converts an applet argument to a MediaLocator.
|
static javax.swing.Icon |
createDisabledIcon(javax.swing.ImageIcon imageIcon)
Create a disabled icon using a gray filter.
|
static java.net.URL |
fileToURL(java.lang.String fileName)
Convert a File to a URL using file: protocol.
|
static java.lang.String |
getExtension(java.io.File f)
Given a File object, return a String representing
the file's extension.
|
static java.lang.String |
getExtension(java.lang.String filename)
Given a String representing a file name, return a String representing
the file's extension.
|
static Time |
getMaximumLatency(Controller[] controllers)
Given an array of Controllers, calculate the maximum
startup latency in seconds.
|
static int |
pickAMaster(Player[] players)
Pick a master Player for an array of Players.
|
static void |
showControls(Controller controller)
Displays each Control not currently being shown.
|
static java.lang.String |
stateToString(int state)
Convert a Controller state to a string
|
public static MediaLocator appletArgToMediaLocator(java.applet.Applet applet, java.lang.String arg)
public static java.net.URL fileToURL(java.lang.String fileName)
throws java.io.IOException,
java.net.MalformedURLException
fileName - The file to convertjava.io.IOExceptionjava.net.MalformedURLExceptionpublic static MediaLocator appArgToMediaLocator(java.lang.String arg)
arg - the url string to convertpublic static java.lang.String stateToString(int state)
state - the state to convertpublic static Time getMaximumLatency(Controller[] controllers)
All Controllers must be at least in the Realized state. If a Controller is not in the realized state, its value is ignored.
If all Controllers report LATENCY_UNKNOWN, return LATENCY_UNKNOWN and let the caller worry about what to do.
controllers - An array of javax.media.Controller objects
all at least realized.
public static java.lang.String getExtension(java.io.File f)
f - A java.io.File objectpublic static java.lang.String getExtension(java.lang.String filename)
filename - A filename as a java.lang.String objectpublic static void showControls(Controller controller)
public static int pickAMaster(Player[] players)
players - an array of Playerspublic static javax.swing.Icon createDisabledIcon(javax.swing.ImageIcon imageIcon)