|
Copyright 2012-02-25 Werner Randelshofer | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectch.randelshofer.util.Applets
public class Applets
Usefull methods for applets.
| Method Summary | |
|---|---|
static java.lang.Integer |
decode(java.lang.String nm)
Decodes a String into an Integer. |
static java.util.Hashtable |
getIndexedKeyValueParameters(java.applet.Applet applet,
java.lang.String name,
java.util.Hashtable defaultValue)
Returns the parameter value of the specified applet or the default value if the parameter is null, the value is returned as a Hashtable. |
static java.lang.String |
getParameter(java.applet.Applet applet,
java.lang.String name)
Returns the parameter value for the specified applet or the command line parameter (main args) when the applet is run as an application. |
static boolean |
getParameter(java.applet.Applet applet,
java.lang.String name,
boolean defaultValue)
Reads a parameter as a boolean value. |
static java.awt.Color |
getParameter(java.applet.Applet applet,
java.lang.String name,
java.awt.Color defaultValue)
Reads a parameter as a color value. |
static double |
getParameter(java.applet.Applet applet,
java.lang.String name,
double defaultValue)
Reads a parameter as a double value. |
static int |
getParameter(java.applet.Applet applet,
java.lang.String name,
int defaultValue)
Reads a parameter as an int value. |
static java.lang.String |
getParameter(java.applet.Applet applet,
java.lang.String name,
java.lang.String defaultValue)
Returns the String value of an applet parameter or the default value if the parameter is null. |
static int[] |
getParameters(java.applet.Applet applet,
java.lang.String name,
int[] defaultValue)
Reads a parameter as an array of comma separated int values. |
static java.lang.String[] |
getParameters(java.applet.Applet applet,
java.lang.String name,
java.lang.String[] defaultValue)
Returns the parameter value for the specified applet or the default value if the parameter is null, the value is returned as an array. |
static void |
setDebug(boolean newValue)
|
static void |
setMainArgs(java.applet.Applet applet,
java.lang.String[] args)
Sets command line arguments. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void setDebug(boolean newValue)
public static void setMainArgs(java.applet.Applet applet,
java.lang.String[] args)
args -
public static java.awt.Color getParameter(java.applet.Applet applet,
java.lang.String name,
java.awt.Color defaultValue)
The color can be represented in the following formats:
applet - The applet.name - The name of the parameter.defaultValue - The default value.
public static java.lang.String getParameter(java.applet.Applet applet,
java.lang.String name,
java.lang.String defaultValue)
applet - The applet from which we want to get the parameter.name - The name of the parameter.defaultValue - This value is returned when the applet returns
null for the parameter.
public static java.lang.String[] getParameters(java.applet.Applet applet,
java.lang.String name,
java.lang.String[] defaultValue)
applet - The applet from which we want to get the parameter.name - The name of the parameter.defaultValue - This value is returned when the applet returns
null for the parameter.
public static java.lang.String getParameter(java.applet.Applet applet,
java.lang.String name)
applet - The applet from which we want to get the parameter.name - The name of the parameter.
public static int getParameter(java.applet.Applet applet,
java.lang.String name,
int defaultValue)
applet - The applet.name - The name of the parameter.defaultValue - The default value.
public static boolean getParameter(java.applet.Applet applet,
java.lang.String name,
boolean defaultValue)
applet - The applet.name - The name of the parameter.defaultValue - The default value.
public static int[] getParameters(java.applet.Applet applet,
java.lang.String name,
int[] defaultValue)
applet - The applet.name - The name of the parameter.defaultValue - The default value.
public static double getParameter(java.applet.Applet applet,
java.lang.String name,
double defaultValue)
applet - The applet.name - The name of the parameter.defaultValue - The default value.
public static java.util.Hashtable getIndexedKeyValueParameters(java.applet.Applet applet,
java.lang.String name,
java.util.Hashtable defaultValue)
The parameter value is parsed according to the following EBNF production:
list ::= entry {"," entry}
entry ::= [key "="] value
key ::= String
value ::= String
The returned Hashtable contains up to two key value pairs for each entry.
If an entry does specify a key, it is put using the specified key into
the hashtable.
For each entry a key is generated which denotes the index of the entry.
If the Hashtable does not contain an entry for the generated key. Then an
entry is put using the generated key as well.
applet - The applet from which we want to get the parameter.name - The name of the parameter.defaultValue - This value is returned when the applet returns
null for the parameter.
public static java.lang.Integer decode(java.lang.String nm)
throws java.lang.NumberFormatException
String into an Integer. Accepts
decimal, hexadecimal, and octal numbers, in the following formats:
[-]
[-] 0x
[-] #
[-] 0
The constant following an (optional) negative sign and/or "radix
specifier" is parsed as by the Integer.parseInt method
with the specified radix (10, 8 or 16). This constant must be positive
or a NumberFormatException will result. The result is made negative if
first character of the specified String is the negative
sign. No whitespace characters are permitted in the
String.
nm - the String to decode.
Integer represented by the specified string.
java.lang.NumberFormatException - if the String does not
contain a parsable integer.Integer.parseInt(String, int)
|
Copyright 2012-02-25 Werner Randelshofer | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||