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


Java Preferences.getInt方法代码示例

本文整理汇总了Java中java.util.prefs.Preferences.getInt方法的典型用法代码示例。如果您正苦于以下问题:Java Preferences.getInt方法的具体用法?Java Preferences.getInt怎么用?Java Preferences.getInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.prefs.Preferences的用法示例。


在下文中一共展示了Preferences.getInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: restoreWindowLocation

import java.util.prefs.Preferences; //导入方法依赖的package包/类
/**
     * This static method can be used to restore the window x,y, position (but
     * not size) of a window based on the Window class name. This is a separate
     * mechanism than the instance methods saveSettings and loadSettings.
     *
     * @param window the window to restore
     * @param prefs user preferences node
     * @see #saveWindowLocation
     */
    public static void restoreWindowLocation(Window window, Preferences prefs) {
        Dimension scr = Toolkit.getDefaultToolkit().getScreenSize();
        String name = window.getClass().getName();
        int x = prefs.getInt(name + ".XPosition", 0);
        x = (int) Math.min(scr.getWidth() - window.getWidth() - 20, x);
        int y = prefs.getInt(name + ".YPosition", 0);
        y = (int) Math.min(scr.getHeight() - window.getHeight() - 20, y);
        window.setLocation(x, y);
//        log.info("restored window "+window.getName()+" to location x,y="+x+","+y);
    }
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:20,代码来源:WindowSaver.java

示例2: getTabInsertString

import java.util.prefs.Preferences; //导入方法依赖的package包/类
/** @deprecated
 * @see Formatter.insertTabString()
 */
public static String getTabInsertString(BaseDocument doc, int offset)
throws BadLocationException {
    int col = getVisualColumn(doc, offset);
    Preferences prefs = CodeStylePreferences.get(doc).getPreferences();
    boolean expandTabs = prefs.getBoolean(SimpleValueNames.EXPAND_TABS, EditorPreferencesDefaults.defaultExpandTabs);
    if (expandTabs) {
        int spacesPerTab = prefs.getInt(SimpleValueNames.SPACES_PER_TAB, EditorPreferencesDefaults.defaultSpacesPerTab);
        if (spacesPerTab <= 0) {
            return ""; //NOI18N
        }
        int len = (col + spacesPerTab) / spacesPerTab * spacesPerTab - col;
        return new String(Analyzer.getSpacesBuffer(len), 0, len);
    } else { // insert pure tab
        return "\t"; // NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:Utilities.java

示例3: createAndShow

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public void createAndShow() throws Exception{
    Preferences Config = TEdit.getConfig();
    JTextArea area = new JTextArea(10,40);
    area.setEditable(false);
              String Font_Name =  Config.get("FONT_NAME","Monospaced");
              int Font_Size = Config.getInt("FONT_SIZE",12);
              int Font_Style = Config.getInt("FONT_STYLE",Font.PLAIN);
              area.setFont(new Font(Font_Name,Font_Style,Font_Size));
              	JScrollPane scroll = new JScrollPane(area,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
		this.add(scroll,BorderLayout.CENTER);
                if(txt == null){
                    BufferedReader br = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("org/ioblako/edit/resources/Help.txt"), "UTF-8"));
                     for (int c = br.read(); c != -1; c = br.read()) sb.append((char)c);
                     txt=sb.toString();
                }
                
                area.setText(txt);
                this.setTitle("Help");
                this.pack();
                this.setVisible(true);
               
}
 
开发者ID:mathhobbit,项目名称:EditCalculateAndChart,代码行数:23,代码来源:HelpFrame.java

示例4: loadConfig

import java.util.prefs.Preferences; //导入方法依赖的package包/类
/**
 * Load config from properties in ressource
 * @throws IOException
 */
private static void loadConfig() throws IOException {
	String authConfigFile = "auth.properties";
	InputStream authConfigStream = AuthHelper.class.getClassLoader().getResourceAsStream(authConfigFile);

	if (authConfigStream != null) {
		props = new Properties();
		props.load(authConfigStream);
	} else {
		throw new FileNotFoundException("Property file '" + authConfigFile + "' not found in the classpath.");
	}
	Preferences p = Preferences.userRoot();
    int OwaNotifierMute = p.getInt("OwaNotifierMute", 0);
    if(OwaNotifierMute > 0) {
    	setMute(true);
    } else {
    	setMute(false);
    }
}
 
开发者ID:OwaNotifier,项目名称:owa-notifier,代码行数:23,代码来源:OwaNotifier.java

示例5: getInputMethodSelectionKeyStroke

import java.util.prefs.Preferences; //导入方法依赖的package包/类
private AWTKeyStroke getInputMethodSelectionKeyStroke(Preferences root) {
    try {
        if (root.nodeExists(inputMethodSelectionKeyPath)) {
            Preferences node = root.node(inputMethodSelectionKeyPath);
            int keyCode = node.getInt(inputMethodSelectionKeyCodeName, KeyEvent.VK_UNDEFINED);
            if (keyCode != KeyEvent.VK_UNDEFINED) {
                int modifiers = node.getInt(inputMethodSelectionKeyModifiersName, 0);
                return AWTKeyStroke.getAWTKeyStroke(keyCode, modifiers);
            }
        }
    } catch (BackingStoreException bse) {
    }

    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:InputContext.java

示例6: JPDABreakpoint

import java.util.prefs.Preferences; //导入方法依赖的package包/类
JPDABreakpoint () {
    Preferences preferences = NbPreferences.forModule(getClass()).node("debugging"); // NOI18N
    int num = preferences.getInt("default.suspend.action", -1); // NOI18N [TODO] create property name constant, use it in ActionsPanel
    if (num == -1) {
        Properties p = Properties.getDefault().getProperties("debugger.options.JPDA");
        num = p.getInt("BreakpointSuspend", JPDABreakpoint.SUSPEND_EVENT_THREAD);
    }
    switch (num) {
        case 0: suspend = SUSPEND_NONE; break;
        case 1: suspend = SUSPEND_EVENT_THREAD; break;
        case 2: suspend = SUSPEND_ALL;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:JPDABreakpoint.java

示例7: updateSliders

import java.util.prefs.Preferences; //导入方法依赖的package包/类
private void updateSliders (Preferences prefs) {
    int pos = prefs.getInt(PROP_PANEL_SLIDER_POSITION, 0);
    if (pos > 0) {
        panel.setSliderPosition(pos);
    }
    pos = prefs.getInt(PROP_BROWSER_SLIDER_POSITION, 0);
    if (pos > 0) {
        browserPanel.setSliderPosition(pos);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:RevisionPicker.java

示例8: disableEditorCaretBlinking

import java.util.prefs.Preferences; //导入方法依赖的package包/类
/**
 * Turns off blinking of the caret in the editor. It is restored at the end
 * of test case in {@link #doMeasurement} method
 */
protected void disableEditorCaretBlinking() {
    Preferences prefs = getMimeLookupPreferences();
    defaultCaretBlinkRate = prefs.getInt(CARET_BLINK_RATE_KEY, 0);
    prefs.putInt(CARET_BLINK_RATE_KEY, 0);
    caretBlinkingDisabled = true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:PerformanceTestCase.java

示例9: getPortNumbers

import java.util.prefs.Preferences; //导入方法依赖的package包/类
/**
 *
 * @return Pair with Sharkopoda control port (key) and Framecapture port (value)
 */
public static Pair<Integer, Integer> getPortNumbers() {
    Preferences prefs = Preferences.userNodeForPackage(SharktopodaSettingsPaneController.class);
    int dSharkPort = Initializer.getConfig().getInt("sharktopoda.defaults.control.port");
    int dFgPort = Initializer.getConfig().getInt("sharktopoda.defaults.framegrab.port");

    try {
        int cport = prefs.getInt(CONTROL_PORT_KEY, dSharkPort);
        int fport = prefs.getInt(FRAMEGRAB_PORT_KEY, dFgPort);
        return new Pair<>(cport, fport);
    }
    catch (Exception e) {
        return null;
    }
}
 
开发者ID:mbari-media-management,项目名称:vars-annotation,代码行数:19,代码来源:SharktopodaSettingsPaneController.java

示例10: load

import java.util.prefs.Preferences; //导入方法依赖的package包/类
void load( Preferences prefs, String prefix ) throws BackingStoreException {
    countLimit = prefs.getInt( prefix+"_countLimit", 100 ); //NOI18N
    enabledProviders.clear();
    String enabled = prefs.get( prefix+"_enabled", "" ); //NOI18N //NOI18N
    if( enabled.trim().length() > 0 ) {
        StringTokenizer tokenizer = new StringTokenizer( enabled, "\n" ); //NOI18N
        while( tokenizer.hasMoreTokens() ) {
            enabledProviders.add( tokenizer.nextToken() );
        }
    } else {
        addDefaultTypes();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:TypesFilter.java

示例11: loadAll

import java.util.prefs.Preferences; //导入方法依赖的package包/类
/**
 * Loads all instances from persistent storage.
 * @return list of {@link ResizeOption}s
 */
public synchronized List<ResizeOption> loadAll() {
    Preferences prefs = getPreferences();
    int count = prefs.getInt("count", 0); // NOI18N
    List<ResizeOption> res = new ArrayList<ResizeOption>(count);
    if (count == 0) {
        res.add(ResizeOption.create(ResizeOption.Type.DESKTOP, NbBundle.getMessage(ResizeOption.class, "Lbl_DESKTOP"),
                1280, 1024, true, true));
        res.add(ResizeOption.create(ResizeOption.Type.TABLET_LANDSCAPE, NbBundle.getMessage(ResizeOption.class, "Lbl_TABLET_LANDSCAPE"),
                1024, 768, true, true));
        res.add(ResizeOption.create(ResizeOption.Type.TABLET_PORTRAIT, NbBundle.getMessage(ResizeOption.class, "Lbl_TABLET_PORTRAIT"),
                768, 1024, true, true));
        res.add(ResizeOption.create(ResizeOption.Type.SMARTPHONE_LANDSCAPE, NbBundle.getMessage(ResizeOption.class, "Lbl_SMARTPHONE_LANDSCAPE"),
                480, 320, true, true));
        res.add(ResizeOption.create(ResizeOption.Type.SMARTPHONE_PORTRAIT, NbBundle.getMessage(ResizeOption.class, "Lbl_SMARTPHONE_PORTRAIT"),
                320, 480, true, true));
        res.add(ResizeOption.create(ResizeOption.Type.WIDESCREEN, NbBundle.getMessage(ResizeOption.class, "Lbl_WIDESCREEN"),
                1680, 1050, false, true));
        res.add(ResizeOption.create(ResizeOption.Type.NETBOOK, NbBundle.getMessage(ResizeOption.class, "Lbl_NETBOOK"),
                1024, 600, false, true));
    } else {
        for (int i = 0; i < count; i++) {
            Preferences node = prefs.node("option" + i); // NOI18N
            ResizeOption option = load(node);
            if (option != null) {
                res.add(option);
            }
        }
    }
    return res;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:ResizeOptions.java

示例12: getSpacesPerTabFor

import java.util.prefs.Preferences; //导入方法依赖的package包/类
/**
 * Returns number of spaces replacing a tab in editor
 * @param mimeType
 * @return
 */
public int getSpacesPerTabFor (String mimeType) {
    int spacesPerTab = 1;
    Preferences pref = MimeLookup.getLookup(mimeType).lookup(Preferences.class);
    if (pref != null) {
        spacesPerTab = pref.getInt(SimpleValueNames.TAB_SIZE, 1);
    }
    return spacesPerTab;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:DiffModuleConfig.java

示例13: estimateCustomStartTime

import java.util.prefs.Preferences; //导入方法依赖的package包/类
/**
 * Makes an estimate how fast a custom indexer is
 *
 * @param indexerName
 * @return estimate time [ms] for indexer start completion
 */
private int estimateCustomStartTime(CustomIndexerFactory srcFactory) {
    // PENDING: modify the time, if the source root is a remote or otherwise slow filesystem
    if (modifiedResourceCount == 0 && allResourceCount == 0) {
        return -1;
    }
    Preferences moduleNode = indexerProfileNode(srcFactory);
    int c1 = moduleNode.getInt("modifiedStartTime", 500); // NOI18N
    int c2 = moduleNode.getInt("fileStartTime", 300); // NOI18N
    int c3 = moduleNode.getInt("startBaseTime", 300); // NOI18N
    moduleNode.putBoolean("hello", true);
    int threshold = Math.max(modifiedResourceCount * c1, allResourceCount * c2) + c3;
    return threshold;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:RepositoryUpdater.java

示例14: readSettings

import java.util.prefs.Preferences; //导入方法依赖的package包/类
private void readSettings() {
    String hyperlinkActivationKeyPropertyValue = System.getProperty("org.netbeans.lib.editor.hyperlink.HyperlinkOperation.activationKey");
    
    if (hyperlinkActivationKeyPropertyValue != null) {
        if ("off".equals(hyperlinkActivationKeyPropertyValue)) { // NOI18N
            this.hyperlinkEnabled = false;
            this.actionKeyMask = (-1);
        } else {
            this.hyperlinkEnabled = true;
            this.actionKeyMask = (-1);
            
            for (int cntr = 0; cntr < hyperlinkActivationKeyPropertyValue.length(); cntr++) {
                int localMask = 0;
                
                switch (hyperlinkActivationKeyPropertyValue.charAt(cntr)) {
                    case 'S': localMask = InputEvent.SHIFT_DOWN_MASK; break;
                    case 'C': localMask = InputEvent.CTRL_DOWN_MASK;  break;
                    case 'A': localMask = InputEvent.ALT_DOWN_MASK;   break;
                    case 'M': localMask = InputEvent.META_DOWN_MASK;  break;
                    default:
                        LOG.warning("Incorrect value of org.netbeans.lib.editor.hyperlink.HyperlinkOperation.activationKey property (only letters CSAM are allowed): " + hyperlinkActivationKeyPropertyValue.charAt(cntr));
                }
                
                if (localMask == 0) {
                    //some problem, ignore
                    this.actionKeyMask = (-1);
                    break;
                }
                
                if (this.actionKeyMask == (-1))
                    this.actionKeyMask = localMask;
                else
                    this.actionKeyMask |= localMask;
            }
            
            if (this.actionKeyMask == (-1)) {
                LOG.warning("Some problem with property org.netbeans.lib.editor.hyperlink.HyperlinkOperation.activationKey, more information might be given above. Falling back to the default behaviour.");
            } else {
                return;
            }
        }
    }
    
    this.hyperlinkEnabled = true;

    Preferences prefs = MimeLookup.getLookup(DocumentUtilities.getMimeType(component)).lookup(Preferences.class);
    // there is in Mac preferences shortcut for META_MASK, by default we use CTRL_DOWN_MASK
    this.actionKeyMask = prefs.getInt(SimpleValueNames.HYPERLINK_ACTIVATION_MODIFIERS, InputEvent.CTRL_DOWN_MASK);
    // there is in Mac preferences shortcut for "META_DONW_MASK | InputEvent.ALT_DOWN_MASK", by default we use Ctrl+Alt
    this.altActionKeyMask = prefs.getInt(SimpleValueNames.ALT_HYPERLINK_ACTIVATION_MODIFIERS, InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:52,代码来源:HyperlinkOperation.java

示例15: load

import java.util.prefs.Preferences; //导入方法依赖的package包/类
void load( Preferences prefs, String prefix ) throws BackingStoreException {
    id = prefs.getInt( prefix+"_optionId", 0 ); //NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:OneOfFilterCondition.java


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