本文整理匯總了Java中java.util.prefs.Preferences.putDouble方法的典型用法代碼示例。如果您正苦於以下問題:Java Preferences.putDouble方法的具體用法?Java Preferences.putDouble怎麽用?Java Preferences.putDouble使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.prefs.Preferences
的用法示例。
在下文中一共展示了Preferences.putDouble方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: deepCopy
import java.util.prefs.Preferences; //導入方法依賴的package包/類
private static void deepCopy(Preferences from, Preferences to) throws BackingStoreException {
for(String kid : from.childrenNames()) {
Preferences fromKid = from.node(kid);
Preferences toKid = to.node(kid);
deepCopy(fromKid, toKid);
}
for(String key : from.keys()) {
String value = from.get(key, null);
if (value == null) continue;
Class type = guessType(value);
if (Integer.class == type) {
to.putInt(key, from.getInt(key, -1));
} else if (Long.class == type) {
to.putLong(key, from.getLong(key, -1L));
} else if (Float.class == type) {
to.putFloat(key, from.getFloat(key, -1f));
} else if (Double.class == type) {
to.putDouble(key, from.getDouble(key, -1D));
} else if (Boolean.class == type) {
to.putBoolean(key, from.getBoolean(key, false));
} else if (String.class == type) {
to.put(key, value);
} else /* byte [] */ {
to.putByteArray(key, from.getByteArray(key, new byte [0]));
}
}
}
示例2: saveWindowBounds
import java.util.prefs.Preferences; //導入方法依賴的package包/類
protected void saveWindowBounds() {
Preferences p = getPrefs();
Rectangle rect = this.getBounds();
p.putDouble(makePrefString("windowX"), rect.getX());
p.putDouble(makePrefString("windowY"), rect.getY());
p.putDouble(makePrefString("windowWidth"), rect.getWidth());
p.putDouble(makePrefString("windowHeight"), rect.getHeight());
}
示例3: saveDividerPositions
import java.util.prefs.Preferences; //導入方法依賴的package包/類
private void saveDividerPositions(String name, SplitPane pane) {
// Pref path is UserNode/Class/name/0 (or 1 or 2)
Preferences p0 = Preferences.userNodeForPackage(getClass());
Preferences p1 = p0.node(name);
double[] pos = pane.getDividerPositions();
for (int i = 0; i < pos.length; i++) {
p1.putDouble(i+ "", pos[i]);
}
}
示例4: sample01
import java.util.prefs.Preferences; //導入方法依賴的package包/類
void sample01(Ini ini) throws IOException
{
Preferences prefs = new IniPreferences(ini);
Preferences bashful = prefs.node("bashful");
String home = bashful.get("homeDir", "/home");
int age = bashful.getInt("age", -1);
bashful.putDouble("weight", 55.6);
//}
assertEquals(DwarfsData.bashful.homeDir, bashful.get("homeDir", null));
assertEquals(DwarfsData.bashful.age, bashful.getInt("age", -1));
assertEquals(55.6, bashful.getDouble("weight", -1), 0.001);
}