|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object processing.app.Preferences
public class Preferences
Storage class for user preferences and environment settings.
This class no longer uses the Properties class, since properties files are iso8859-1, which is highly likely to be a problem when trying to save sketch folders and locations.
The GUI portion in here is really ugly, as it uses exact layout. This was done in frustration one evening (and pre-Swing), but that's long since past, and it should all be moved to a proper swing layout like BoxLayout.
This is very poorly put together, that the preferences panel and the actual preferences i/o is part of the same code. But there hasn't yet been a compelling reason to bother with the separation aside from concern about being lectured by strangers who feel that it doesn't look like what they learned in CS class.
Would also be possible to change this to use the Java Preferences API. Some useful articles here and here. However, haven't implemented this yet for lack of time, but more importantly, because it would entail writing to the registry (on Windows), or an obscure file location (on Mac OS X) and make it far more difficult to find the preferences to tweak them by hand (no! stay out of regedit!) or to reset the preferences by simply deleting the preferences.txt file.
Field Summary | |
---|---|
static int |
BUTTON_HEIGHT
Standardized button height. |
static int |
BUTTON_WIDTH
Standardized width for buttons. |
Constructor Summary | |
---|---|
Preferences()
|
Method Summary | |
---|---|
static java.lang.String |
get(java.lang.String attribute)
|
static boolean |
getBoolean(java.lang.String attribute)
|
static java.awt.Color |
getColor(java.lang.String name)
|
static java.lang.String |
getDefault(java.lang.String attribute)
|
static java.awt.Font |
getFont(java.lang.String attr)
|
static int |
getInteger(java.lang.String attribute)
|
java.awt.Dimension |
getPreferredSize()
|
static SyntaxStyle |
getStyle(java.lang.String what)
|
static void |
set(java.lang.String attribute,
java.lang.String value)
|
static void |
setBoolean(java.lang.String attribute,
boolean value)
|
static void |
setColor(java.lang.String attr,
java.awt.Color what)
|
static void |
setInteger(java.lang.String key,
int value)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int BUTTON_WIDTH
public static int BUTTON_HEIGHT
Constructor Detail |
---|
public Preferences()
Method Detail |
---|
public java.awt.Dimension getPreferredSize()
public static java.lang.String get(java.lang.String attribute)
public static java.lang.String getDefault(java.lang.String attribute)
public static void set(java.lang.String attribute, java.lang.String value)
public static boolean getBoolean(java.lang.String attribute)
public static void setBoolean(java.lang.String attribute, boolean value)
public static int getInteger(java.lang.String attribute)
public static void setInteger(java.lang.String key, int value)
public static java.awt.Color getColor(java.lang.String name)
public static void setColor(java.lang.String attr, java.awt.Color what)
public static java.awt.Font getFont(java.lang.String attr)
public static SyntaxStyle getStyle(java.lang.String what)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |