本文整理汇总了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);
}