Best code examples for Java 8 Preferences class (java.util.prefs.Preferences)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Preferences class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Java 8 Preferences examples from Open Source projects
This code example shows how to use the following methods: get, put
191:	String old = applicationPreferences.get(name, ""); 
192:	applicationPreferences.put(name, value); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getBoolean, getInt, putDouble
180:	int ival  = node.getInt("extraOne", 0); 
-
183:	ival  = node.getInt("extraTwo", 0); 
-
186:	ival  = node.getInt("num_rows", 0); 
-
189:	ival  = node.getInt("missing", 0); 
-
192:	boolean bval  = node.getBoolean("TestBoolean", false); 
-
195:	node.putDouble("TestFloat", -999.0F); 
196:	node.putDouble("TestDouble", 3.14159); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getInt
239:	setTopActivity(prefs.getInt(KEY_TOP_ACTIVITY, DEFAULT_TOP_ACTIVITY)); 
240:	setTopHighlights(prefs.getInt(KEY_TOP_HIGHLIGHTS, DEFAULT_TOP_HIGHLIGHTS)); 
-
242:	setActivityWeight(prefs.getInt(KEY_ACTIVITY_WEIGHT, DEFAULT_ACTIVITY_WEIGHT)); 
243:	setInlinksWeight(prefs.getInt(KEY_INLINKS_WEIGHT, DEFAULT_INLINKS_WEIGHT)); 
244:	setClickthroughsWeight(prefs.getInt(KEY_CLICKTHROUGHS_WEIGHT, DEFAULT_CLICKTHROUGHS_WEIGHT)); 
245:	setFeedViewsWeight(prefs.getInt(KEY_FEED_VIEWS_WEIGHT, DEFAULT_FEED_VIEWS_WEIGHT)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: put, putBoolean, putByteArray, putDouble, putFloat
73:	subnode.putDouble("testD", 3.14158); 
74:	subnode.putFloat("testF", 1.23457F); 
75:	subnode.putLong("testL", 12345678901L); 
76:	subnode.putInt("testI", 123456780); 
77:	subnode.put("testS", "youdBeLivebyNow"); 
78:	subnode.putBoolean("testB", false); 
-
84:	subnode.putByteArray("testBA", barr2); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getBoolean, getInt, getLong, putBoolean, sync
396:	if ( m_prefs.getBoolean( IS_UPDATE_AVAILABLE_KEY, false ) ) { 
-
398:	m_prefs.putBoolean( IS_UPDATE_AVAILABLE_KEY, false ); 
-
474:	if ( m_prefs.getInt( REMIND_KEY, 0 ) == REMIND_LATER ) { 
-
476:	final long later = m_prefs.getLong( LATER_KEY, 0 ); 
-
494:	return m_prefs.getBoolean( CHECK_FOR_UPDATE_KEY, true ); 
-
572:	m_prefs.sync(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: flush
83:	preferences.flush(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDouble
38:	private static double EllipticX = Prefs.getDouble(EllipticXTag, 30); 
-
40:	private static double EllipticY = Prefs.getDouble(EllipticYTag, 30); 
-
44:	Prefs.getDouble(EllipticCloneXTag, EllipticX); 
-
46:	Prefs.getDouble(EllipticCloneYTag, 0); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: get
54:	return pref.get(DATABASE_URL, "localhost"); 
-
66:	return pref.get(DATABASE_PORT, "1527"); 
-
74:	return pref.get(DATABASE_NAME, "posdb"); 
-
82:	return pref.get(DATABASE_USER, "app"); 
-
90:	return pref.get(DATABASE_PASSWORD, "sa"); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: get, remove
85:	name = Prefs.get(NewFileNameKey + context, ""); 
-
87:	String path = Prefs.get(DirectoryKey + context, null); 
-
94:	String text = Prefs.get(ExportKey + context, null); 
-
110:	Prefs.remove(ExportKey + context); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: get, getBoolean
230:	setEnabled(prefs.getBoolean(PROP_TWITTER_ENABLED, false)); 
231:	setScreenName(prefs.get(PROP_TWITTER_SCREEN_NAME, null)); 
232:	setAccessToken(prefs.get(PROP_TWITTER_ACCESS_TOKEN, null)); 
233:	setTokenSecret(prefs.get(PROP_TWITTER_TOKEN_SECRET, null)); 
234:	setProfilePics(prefs.getBoolean(PROP_PROFILE_PICS, true)); 
235:	setPasteLink(prefs.getBoolean(PROP_PASTE_LINK, true)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: flush, put, putInt
54:	PREFERENCES.putInt("width", lastWindowSize.width); 
55:	PREFERENCES.putInt("height", lastWindowSize.height); 
56:	PREFERENCES.putInt("view", lastView); 
57:	PREFERENCES.put("crawl", lastCrawl); 
-
60:	PREFERENCES.flush(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: putBoolean, putInt
166:	prefs.putBoolean("floating", frame != null); 
-
169:	prefs.putInt("width", frame.getWidth()); 
170:	prefs.putInt("height", frame.getHeight()); 
171:	prefs.putInt("x", frame.getX()); 
172:	prefs.putInt("y", frame.getY()); 
-
175:	prefs.putInt("dividerLocation", splitPane.getDividerLocation()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: get, getInt
21:	d.setFont(new Font(prefs.get("Font", d.getFont().toString()), Font.PLAIN, d.getFontSize())); 
22:	d.setFontSize(prefs.getInt("FontSize", d.getFontSize())); 
23:	d.setFontColor(new Color(Integer.parseInt(prefs.get("FontColor", String.valueOf(d.getFontColor().getRGB()))))); 
24:	d.setBackColor(new Color(Integer.parseInt(prefs.get("BackColor", String.valueOf(d.getBackColor().getRGB()))))); 
25:	c.setBounds(prefs.getInt("x", c.getX()), prefs.getInt("y", c.getY()), c.getWidth(), c.getHeight()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDouble, getInt, putDouble, putInt
93:	int ival  = node.getInt("extraOne", 0); 
-
96:	ival  = node.getInt("extraTwo", 0); 
-
99:	double dval  = node.getDouble("TestDouble", 0.0); 
-
102:	node.putDouble("TestDouble", 3.14159); 
103:	node.putDouble("TestFloat", -999.0); 
104:	node.putInt("extraTwo", 2); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: get
66:	return pref.get(DATABASE_URL, "localhost"); 
-
78:	return pref.get(DATABASE_PORT, "1527"); 
-
86:	return pref.get(DATABASE_NAME, "posdb"); 
-
94:	return pref.get(DATABASE_USER, "app"); 
-
102:	return pref.get(DATABASE_PASSWORD, "sa"); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: get
34:	scannerConfig = new ScannerConfig(preferences); 
-
36:	favoritesConfig = new FavoritesConfig(preferences); 
37:	openersConfig = new OpenersConfig(preferences); 
38:	language = preferences.get("language", "system"); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: get, getBoolean, getInt
302:	config.setEnabled(prefs.getBoolean(PREFIX + PROP_ENABLED, DEFAULT_ENABLED)); 
303:	config.setNegativeExpressions(prefs.get(PREFIX + PROP_NEGATIVE_EXPRESSIONS, DEFAULT_NEGATIVE_EXPRESSIONS)); 
304:	config.setPositiveExpressions(prefs.get(PREFIX + PROP_POSITIVE_EXPRESSIONS, DEFAULT_POSITIVE_EXPRESSIONS)); 
305:	config.setNegativeThreshold(prefs.getInt(PREFIX + PROP_NEGATIVE_THRESHOLD, DEFAULT_NEGATIVE_THRESHOLD)); 
306:	config.setPositiveThreshold(prefs.getInt(PREFIX + PROP_POSITIVE_THRESHOLD, DEFAULT_POSITIVE_THRESHOLD)); 
307:	config.setPositiveColor(prefToColor(prefs.get(PREFIX + PROP_POSITIVE_COLOR, UifUtilities.colorToHex(DEFAULT_POSITIVE_COLOR)))); 
308:	config.setNegativeColor(prefToColor(prefs.get(PREFIX + PROP_NEGATIVE_COLOR, UifUtilities.colorToHex(DEFAULT_NEGATIVE_COLOR)))); 
-
313:	String keywords = prefs.get(KEY_KEYWORDS, null); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: flush, put
175:	prefs.put( PROXYSET, proxySet ); 
-
179:	prefs.put( PROXYHOST, proxyHost ); 
-
183:	prefs.put( PROXYPORT, proxyPort ); 
-
187:	prefs.put( NONPROXYHOSTS, nonProxyHosts ); 
-
191:	prefs.flush(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: put, putBoolean, putByteArray, putDouble, putFloat
69:	subnode.putDouble("testD", 3.14158); 
70:	subnode.putFloat("testF", 1.23457F); 
71:	subnode.putLong("testL", 12345678901L); 
72:	subnode.putInt("testI", 123456780); 
73:	subnode.put("testS", "youdBeLivebyNow"); 
74:	subnode.putBoolean("testB", false); 
-
80:	subnode.putByteArray("testBA", barr2); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: flush, node, put, putInt
92:	final Preferences torrentPrefs = this.m_torrents.node(key); 
-
97:	torrentPrefs.put(TORRENT_URI, uri); 
98:	torrentPrefs.put(TORRENT_FILE, torrentFile.getCanonicalPath()); 
99:	torrentPrefs.put(INCOMPLETE_DIR, incompleteDir.getCanonicalPath()); 
100:	torrentPrefs.putInt(TORRENT_STATE, torrentState); 
-
109:	torrentPrefs.flush(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: flush, get, put, putInt
29:	String factoryInitial = p.get(KEY_NAMING_FACTORY_INITIAL, null); 
-
32:	p.put(KEY_NAMING_FACTORY_INITIAL, jndi.getProperty(InitialContext.INITIAL_CONTEXT_FACTORY)); 
33:	p.put(KEY_NAMING_PROVIDER_URL, jndi.getProperty(InitialContext.PROVIDER_URL)); 
34:	p.putInt(KEY_HEALTHCHECK_INTERVAL, 60000); 
35:	p.putInt(KEY_RECONNECT_INTERVAL, 10000); 
36:	p.flush(); 
-
38:	String websocketUrl = p.get(KEY_WEBSOCKET_URL, null); 
-
41:	p.put(KEY_WEBSOCKET_URL, websocket.getProperty(KEY_WEBSOCKET_URL)); 
42:	p.flush(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getBoolean
62:	return locationPolicy.getBoolean(key, locationPolicy.getBoolean(DEFAULT_KEY, true)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: clear
275:	prefs.storeIn(p); 
-
280:	prefs.storeIn(p); 
-
285:	p.clear(); 
-
287:	prefs.storeIn(p); 
-
289:	prefs.restoreFrom(p); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getInt
108:	rTolerance = prefs.getInt("rtolerance", rTolerance); 
109:	gTolerance = prefs.getInt("gtolerance", gTolerance); 
110:	bTolerance = prefs.getInt("btolerance", bTolerance); 
111:	color = new Color(prefs.getInt("color", color.getRGB())); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDouble, getInt
114:	double height = p.getDouble(HEIGHT, 0); 
115:	double width = p.getDouble(WIDTH, 0); 
116:	int orientation = p.getInt(ORIENTATION, 0); 
117:	double imageableHeight = p.getDouble(IMAGEABLE_HEIGHT, 0); 
118:	double imageableWidth = p.getDouble(IMAGEABLE_WIDTH, 0); 
119:	double imageableX = p.getDouble(IMAGEABLE_X, 0); 
120:	double imageableY = p.getDouble(IMAGEABLE_Y, 0); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getLong, putLong, remove
177:	subNode.putLong("testL", 12345678900L); 
178:	ll = subNode.getLong("testL", 0); 
-
181:	subNode.remove("testL"); 
182:	ll = subNode.getLong("testL", 0); 
Full Snippet Info
6
CodeRank
Related Java 8 Preferences Questions & Answers:
See Code Examples for Java 8 Preferences Methods: