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