當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。