Sample Code Sample Code: Preferences


// Our "size" preference can be "small", "medium", or "large"
// Assume user selected "large".
String sizeKey = getClass().getName() + ".size";
properties.setProperty(sizeKey, "large"); Later on, possibly in the next SMC session, get the preference String sizePreference = properties.getProperty(sizeKey); if (sizePreference == "large") // do something for "large" else if (sizePreference == "medium") ...