FileDocCategorySizeDatePackage
PrefsDemo.javaAPI DocExample813Sun Feb 29 09:38:58 GMT 2004None

PrefsDemo

public class PrefsDemo extends Object
Simple demonstration of using Preferences.
version
$Id: PrefsDemo.java,v 1.2 2004/02/29 15:38:58 ian Exp $

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)


		// Setup the Preferences for this application, by class.
		Preferences prefs = Preferences.userNodeForPackage(PrefsDemo.class);

		// Retrieve some preferences previously stored, with defaults in case
		// this is the first run.
		String text    = prefs.get("textFontName", "lucida-bright");
		String display = prefs.get("displayFontName", "lucida-blackletter");
		System.out.println(text);
		System.out.println(display);

		// Assume the user chose new preference values: Store them back.
		prefs.put("textFontName", "times-roman");
		prefs.put("displayFontName", "helvetica");