public class SimbrainPreferences
extends java.lang.Object
For sample usage see
DesktopNetworkDialog
Note that if no default value is found in the default map no exception is thrown and a "default-default" (a default for the default value) is assigned. This is 0 for numbers and an empty string for string.
Modifier and Type | Class and Description |
---|---|
static class |
SimbrainPreferences.PropertyNotFoundException
Thrown when a property cannot be found.
|
Constructor and Description |
---|
SimbrainPreferences() |
Modifier and Type | Method and Description |
---|---|
static double |
getDouble(java.lang.String property)
Retrieve a property whose value is a double.
|
static float |
getFloat(java.lang.String property)
Retrieve a property whose value is a float.
|
static int |
getInt(java.lang.String property)
Retrieve a property whose value is an integer.
|
static java.lang.String |
getString(java.lang.String property)
Retrieve a property whose value is a string.
|
static void |
putDouble(java.lang.String property,
double val)
Set a property whose value is a double.
|
static void |
putFloat(java.lang.String property,
float val)
Set a property whose value is a float.
|
static void |
putInt(java.lang.String property,
int val)
Set a property whose value is a integer.
|
static void |
putString(java.lang.String property,
java.lang.String val)
Set a property whose value is a String.
|
static void |
restoreDefaultSetting(java.lang.String key)
Reverts a setting to its default value.
|
public static void restoreDefaultSetting(java.lang.String key)
key
- the name of the property whose value should be revertedpublic static void putString(java.lang.String property, java.lang.String val)
property
- the property nameval
- the string valuepublic static java.lang.String getString(java.lang.String property) throws SimbrainPreferences.PropertyNotFoundException
property
- the property nameSimbrainPreferences.PropertyNotFoundException
- exception thrown when the property is
not foundpublic static void putDouble(java.lang.String property, double val)
property
- the property nameval
- the double valuepublic static double getDouble(java.lang.String property) throws SimbrainPreferences.PropertyNotFoundException
property
- the property nameSimbrainPreferences.PropertyNotFoundException
- exception thrown when the property is
not foundpublic static void putInt(java.lang.String property, int val)
property
- the property nameval
- the int valuepublic static int getInt(java.lang.String property) throws SimbrainPreferences.PropertyNotFoundException
property
- the property nameSimbrainPreferences.PropertyNotFoundException
- exception thrown when the property is
not foundpublic static void putFloat(java.lang.String property, float val)
property
- the property nameval
- the float valuepublic static float getFloat(java.lang.String property) throws SimbrainPreferences.PropertyNotFoundException
property
- the property nameSimbrainPreferences.PropertyNotFoundException
- exception thrown when the property is
not found