當前位置: 首頁>>代碼示例>>Java>>正文


Java Preferences.putInt方法代碼示例

本文整理匯總了Java中java.util.prefs.Preferences.putInt方法的典型用法代碼示例。如果您正苦於以下問題:Java Preferences.putInt方法的具體用法?Java Preferences.putInt怎麽用?Java Preferences.putInt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.prefs.Preferences的用法示例。


在下文中一共展示了Preferences.putInt方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: saveAsLast

import java.util.prefs.Preferences; //導入方法依賴的package包/類
public void saveAsLast() {
	if (!isValid()) return;

	Preferences root = Preferences.userRoot().node(userPrefFolder).node(userPrefKey);

	try {
		saveList(root.node(pathsAKey), pathsA);
		saveList(root.node(pathsBKey), pathsB);
		saveList(root.node(classPathAKey), classPathA);
		saveList(root.node(classPathBKey), classPathB);
		saveList(root.node(pathsSharedKey), sharedClassPath);
		root.putBoolean(inputsBeforeClassPathKey, inputsBeforeClassPath);
		if (uidHost != null) root.put("uidHost", uidHost);
		if (uidPort != 0) root.putInt("uidPort", uidPort);
		if (uidUser != null) root.put("uidUser", uidUser);
		if (uidPassword != null) root.put("uidPassword", uidPassword);
		if (uidProject != null) root.put("uidProject", uidProject);
		if (uidVersionA != null) root.put("uidVersionA", uidVersionA);
		if (uidVersionB != null) root.put("uidVersionB", uidVersionB);

		root.flush();
	} catch (BackingStoreException e) {
		throw new RuntimeException(e);
	}
}
 
開發者ID:sfPlayer1,項目名稱:Matcher,代碼行數:26,代碼來源:ProjectConfig.java

示例2: save

import java.util.prefs.Preferences; //導入方法依賴的package包/類
public void save() throws IOException {
    try {
        Preferences prefs = NbPreferences.forModule(FilterRepository.class);
        prefs = prefs.node("Filters"); //NOI18N
        prefs.clear();
        prefs.putBoolean("firstTimeStart", false); //NOI18N
        prefs.putBoolean("firstTimeStartWithIssue", false); //NOI18N

        prefs.putInt("count", filters.size()); //NOI18N
        prefs.putInt("active", active); //NOI18N
        for (int i = 0; i < filters.size(); i++) {
            NotificationFilter filter = filters.get(i);
            filter.save(prefs, "Filter_" + i); //NOI18N
        }
    } catch (BackingStoreException bsE) {
        throw new IOException("Cannot save filter repository", bsE);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:FilterRepository.java

示例3: saveWindowLocation

import java.util.prefs.Preferences; //導入方法依賴的package包/類
/**
     * This static method can be used to save the window x,y, position (but not
     * size). This statis method saves the window origin but not the size, based
     * on a classname-based key in the supplied preferences node.
     *
     * @param window the window to save for
     * @param prefs user preferences node
     * @see #restoreWindowLocation
     */
    public static void saveWindowLocation(Window window, Preferences prefs) {
        String name = window.getClass().getName();
        Point p = new Point(0, 0);
        try {
            p = window.getLocationOnScreen();
        } catch (IllegalComponentStateException e) {
            p = window.getLocation();
        }
        prefs.putInt(name + ".XPosition", (int) p.getX());
        prefs.putInt(name + ".YPosition", (int) p.getY());
//        log.info("saved location for window "+name);
    }
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:22,代碼來源:WindowSaver.java

示例4: init

import java.util.prefs.Preferences; //導入方法依賴的package包/類
private void init() {
    Preferences prefs = getConfigurationsRoot();
    try {
        for (String kid:prefs.childrenNames()) {
            if (kid.startsWith(RULE_PREFIX)) {
                Preferences p = prefs.node(kid);
                String displayName = p.get("display.name", "unknown");
                create(kid.substring(RULE_PREFIX.length()), displayName);
            }
        }
    } catch (BackingStoreException ex) {
        Exceptions.printStackTrace(ex);
    }
    if (configs.isEmpty()) {
        create("default", NbBundle.getMessage(ConfigurationsManager.class, "DN_Default"));
    }
    prefs.putInt(KEY_CONFIGURATIONS_VERSION, CURRENT_CONFIGURATIONS_VERSION);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:ConfigurationsManager.java

示例5: saveLuytenPreferences

import java.util.prefs.Preferences; //導入方法依賴的package包/類
private void saveLuytenPreferences(Preferences prefs) throws Exception {
    for (Field field : LuytenPreferences.class.getDeclaredFields()) {
        if (Modifier.isStatic(field.getModifiers()))
            continue;
        field.setAccessible(true);
        String prefId = field.getName();
        Object value = field.get(luytenPreferences);

        if (field.getType() == String.class) {
            prefs.put(prefId, (String) (value == null ? "" : value));

        } else if (field.getType() == Boolean.class || field.getType() == boolean.class) {
            prefs.putBoolean(prefId, (Boolean) (value == null ? new Boolean(false) : value));

        } else if (field.getType() == Integer.class || field.getType() == int.class) {
            prefs.putInt(prefId, (Integer) (value == null ? new Integer(0) : value));
        }
    }
}
 
開發者ID:hsswx7,項目名稱:CS4500GroupProject,代碼行數:20,代碼來源:ConfigSaver.java

示例6: testInheritedEventsMasked

import java.util.prefs.Preferences; //導入方法依賴的package包/類
/** 
 * Checks that modifications to the ihnerited store are not fired if
 * the local store overrides
 */
public void testInheritedEventsMasked() throws Exception {
    Preferences stored = new MapPreferences();
    Preferences inherited = new MapPreferences();
    
    inherited.putInt("intValue", 100);
    stored.putInt("intValue", 10);

    MemoryPreferences mem = MemoryPreferences.getWithInherited(this, inherited, stored);
    Preferences test = mem.getPreferences();
    
    PL pl = new PL();
    test.addPreferenceChangeListener(pl);
    
    // change
    pl.arm();
    inherited.putInt("intValue", 3);
    pl.waitEvent();
    assertEquals(0, pl.changeCount);
    
    // remove not inherited
    pl.arm();
    inherited.remove("intValue");
    pl.waitEvent();
    assertEquals(0, pl.changeCount);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:30,代碼來源:ProxyPreferencesImplTest.java

示例7: showDialog

import java.util.prefs.Preferences; //導入方法依賴的package包/類
private static boolean showDialog(URL whereTo) {
    String msg = NbBundle.getMessage(FeedbackSurvey.class, "MSG_FeedbackSurvey_Message");
    String tit = NbBundle.getMessage(FeedbackSurvey.class, "MSG_FeedbackSurvey_Title");
    String yes = NbBundle.getMessage(FeedbackSurvey.class, "MSG_FeedbackSurvey_Yes");
    String later = NbBundle.getMessage(FeedbackSurvey.class, "MSG_FeedbackSurvey_Later");
    String never = NbBundle.getMessage(FeedbackSurvey.class, "MSG_FeedbackSurvey_Never");
    
    NotifyDescriptor nd = new NotifyDescriptor.Message(msg, NotifyDescriptor.QUESTION_MESSAGE);
    nd.setTitle(tit);
    //Object[] buttons = { yes, later, never };
    JButton yesButton = new JButton();
    yesButton.getAccessibleContext().setAccessibleDescription( 
            NbBundle.getMessage(FeedbackSurvey.class, "ACSD_FeedbackSurvey_Yes"));
    Mnemonics.setLocalizedText(yesButton, yes);
    JButton laterButton = new JButton();
    laterButton.getAccessibleContext().setAccessibleDescription( 
            NbBundle.getMessage(FeedbackSurvey.class, "ACSD_FeedbackSurvey_Later"));
    Mnemonics.setLocalizedText(laterButton, later);
    JButton neverButton = new JButton();
    neverButton.getAccessibleContext().setAccessibleDescription( 
            NbBundle.getMessage(FeedbackSurvey.class, "ACSD_FeedbackSurvey_Never"));
    Mnemonics.setLocalizedText(neverButton, never);
    Object[] buttons = { yesButton, laterButton, neverButton };
    nd.setOptions(buttons);
    Object res = DialogDisplayer.getDefault().notify(nd);
    
    if (res == yesButton) {
        HtmlBrowser.URLDisplayer.getDefault().showURL(whereTo);
        return true;
    } else {
        if( res == neverButton ) {
            Preferences prefs = NbPreferences.forModule(FeedbackSurvey.class);
            prefs.putInt("feedback.survey.show.count", (int)bundledInt("MSG_FeedbackSurvey_AskTimes")); // NOI18N
        }
        return false;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:38,代碼來源:FeedbackSurvey.java

示例8: testNewLineIndentationAtMultilineCommentStartWithTabIndents

import java.util.prefs.Preferences; //導入方法依賴的package包/類
public void testNewLineIndentationAtMultilineCommentStartWithTabIndents() throws Exception {
    Preferences preferences = MimeLookup.getLookup(JavaTokenId.language().mimeType()).lookup(Preferences.class);
    preferences.putBoolean("expand-tabs", false);
    preferences.putInt("tab-size", 4);
    preferences.putBoolean("enableBlockCommentFormatting", true);
    try {
        performNewLineIndentationTest("package t;\npublic class T {\n\t/*|\n\tpublic void op() {\n\t}\n}\n",
                "package t;\npublic class T {\n\t/*\n\t * \n\tpublic void op() {\n\t}\n}\n");
    } finally {
        preferences.remove("enableBlockCommentFormatting");
        preferences.remove("tab-size");
        preferences.remove("expand-tabs");
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:ReindenterTest.java

示例9: testNewLineIndentationInsideMultilineCommentWithTabIndents

import java.util.prefs.Preferences; //導入方法依賴的package包/類
public void testNewLineIndentationInsideMultilineCommentWithTabIndents() throws Exception {
    Preferences preferences = MimeLookup.getLookup(JavaTokenId.language().mimeType()).lookup(Preferences.class);
    preferences.putBoolean("expand-tabs", false);
    preferences.putInt("tab-size", 4);
    preferences.putBoolean("enableBlockCommentFormatting", true);
    try {
        performNewLineIndentationTest("package t;\npublic class T {\n\t/*|\n\t */\n\tpublic void op() {\n\t}\n}\n",
                "package t;\npublic class T {\n\t/*\n\t * \n\t */\n\tpublic void op() {\n\t}\n}\n");
    } finally {
        preferences.remove("enableBlockCommentFormatting");
        preferences.remove("tab-size");
        preferences.remove("expand-tabs");
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:ReindenterTest.java

示例10: testLineIndentationInsideMultilineCommentWithTabIndents

import java.util.prefs.Preferences; //導入方法依賴的package包/類
public void testLineIndentationInsideMultilineCommentWithTabIndents() throws Exception {
    Preferences preferences = MimeLookup.getLookup(JavaTokenId.language().mimeType()).lookup(Preferences.class);
    preferences.putBoolean("expand-tabs", false);
    preferences.putInt("tab-size", 4);
    preferences.putBoolean("enableBlockCommentFormatting", true);
    try {
        performLineIndentationTest("package t;\npublic class T {\n\t/*\n|\n\t */\n\tpublic void op() {\n\t}\n}\n",
                "package t;\npublic class T {\n\t/*\n\t * \n\t */\n\tpublic void op() {\n\t}\n}\n");
    } finally {
        preferences.remove("enableBlockCommentFormatting");
        preferences.remove("tab-size");
        preferences.remove("expand-tabs");
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:ReindenterTest.java

示例11: setLogLevel

import java.util.prefs.Preferences; //導入方法依賴的package包/類
@Override public void setLogLevel(int level) {
    Preferences p = Preferences.userNodeForPackage(LogViewLogger.class);
    p.putInt("loglevel", level);
    try {
        p.flush();
    } catch (BackingStoreException e) {
    }
    this.level = level;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:10,代碼來源:LogViewLogger.java

示例12: formWindowClosing

import java.util.prefs.Preferences; //導入方法依賴的package包/類
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
    map.dispose();
    
    //Store window location and size
    Preferences prefs = Preferences.userNodeForPackage(getClass());
    prefs.putInt(KEY_FRAME_EXTENDED_STATE, getExtendedState());
    Dimension size = getSize();
    prefs.putInt(KEY_FRAME_WIDTH, size.width);
    prefs.putInt(KEY_FRAME_HEIGHT, size.height);
    java.awt.Point location = getLocation();
    prefs.putInt(KEY_FRAME_LOCATION_X, (int) Math.round(location.getX()));
    prefs.putInt(KEY_FRAME_LOCATION_Y, (int) Math.round(location.getY()));
}
 
開發者ID:Esri,項目名稱:defense-solutions-proofs-of-concept,代碼行數:14,代碼來源:VehicleCommanderJFrame.java

示例13: setMute

import java.util.prefs.Preferences; //導入方法依賴的package包/類
/**
 * Update mute status in Java/Prefs, this state is saving and restoring at OwaNotifier boot
 * @param value
 * 	true to set OwaNotifier in mute mode
 */
public static void setMute(boolean value) {
	Preferences p = Preferences.userRoot();
	if(value) {
		p.putInt("OwaNotifierMute", 1);
		OwaNotifier.mute = true;
	} else {
		p.putInt("OwaNotifierMute", 0);
		OwaNotifier.mute = false;
	}
}
 
開發者ID:OwaNotifier,項目名稱:owa-notifier,代碼行數:16,代碼來源:OwaNotifier.java

示例14: save

import java.util.prefs.Preferences; //導入方法依賴的package包/類
private void save(Preferences prefs, ResizeOption option) {
    prefs.put("displayName", option.getDisplayName()); // NOI18N
    prefs.putInt("width", option.getWidth()); // NOI18N
    prefs.putInt("height", option.getHeight()); // NOI18N
    prefs.putBoolean("toolbar", option.isShowInToolbar()); // NOI18N
    prefs.putBoolean("default", option.isDefault()); // NOI18N
    prefs.put("type", option.getType().name()); // NOI18N
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:ResizeOptions.java

示例15: save

import java.util.prefs.Preferences; //導入方法依賴的package包/類
void save( Preferences prefs, String prefix ) throws BackingStoreException {
    prefs.putBoolean( prefix+"_allTrue", allTrue ); //NOI18N
    prefs.putInt( prefix+"_count", appliedConditions.size() ); //NOI18N
    for( int i=0; i<appliedConditions.size(); i++ ) {
        appliedConditions.get( i ).save( prefs, prefix+"_condition_" + i ); //NOI18N
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:KeywordsFilter.java


注:本文中的java.util.prefs.Preferences.putInt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。