当前位置: 首页>>代码示例>>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;未经允许,请勿转载。