当前位置: 首页>>代码示例>>Java>>正文


Java Preferences.putDouble方法代码示例

本文整理汇总了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]));
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:FormattingCustomizerPanel.java

示例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());
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:9,代码来源:MapOutputViewer.java

示例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]);
    }
}
 
开发者ID:mbari-media-management,项目名称:vars-annotation,代码行数:10,代码来源:ControlsPaneController.java

示例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);
    }
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:15,代码来源:PrefsTutorial.java


注:本文中的java.util.prefs.Preferences.putDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。