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


Java Preferences.get方法代码示例

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


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

示例1: 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

示例2: getPreferredUIClass

import java.util.prefs.Preferences; //导入方法依赖的package包/类
/**
 * Checks Preferences for look and feel class name that user selected in Options window.
 * @return Look and feel class selected in Options window or null.
 */
private static Class getPreferredUIClass() {
    Preferences prefs = NbPreferences.root().node( "laf" ); //NOI18N
    String uiClassName = prefs.get( "laf", null ); //NOI18N
    if( null == uiClassName )
        return null;
    ClassLoader loader = Lookup.getDefault().lookup( ClassLoader.class );
    if( null == loader )
        loader = ClassLoader.getSystemClassLoader();
    try {
        Class uiClass = loader.loadClass( uiClassName );
        return uiClass;
    } catch( ClassNotFoundException ex ) {
        //HACK ModuleInstall.uninstalled() is never called so let's check if Dark Themes module has been uninstalled
        if( prefs.getBoolean( "dark.themes.installed", false) ) {
            prefs.remove( "laf" ); //NOI18N
            prefs.remove( "dark.themes.installed" ); //NOI18N
        } else {
            Logger.getLogger( CoreBridgeImpl.class.getName() ).log( Level.INFO, "Cannot use look and feel class: " + uiClassName, ex ); //NOI18N
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:CoreBridgeImpl.java

示例3: arePrefsChanged

import java.util.prefs.Preferences; //导入方法依赖的package包/类
private boolean arePrefsChanged(String mimeType) {
    boolean isChanged = false;
    Preferences prefs = pf.getPreferences(mimeType);
    Preferences savedPrefs = MimeLookup.getLookup(mimeType).lookup(Preferences.class);
    HashSet<String> hashSet = new HashSet<String>();
    try {
        hashSet.addAll(Arrays.asList(prefs.keys()));
        hashSet.addAll(Arrays.asList(savedPrefs.keys()));
    } catch (BackingStoreException ex) {
        return false;
    }
    for (String key : hashSet) {
        String current = prefs.get(key, null);
        String saved = savedPrefs.get(key, null);
        if (saved == null) {
            saved = selector.getSavedValue(mimeType, key);
        }
        isChanged |= current == null ? saved != null : !current.equals(saved);
        if (isChanged) { // no need to iterate further
            return true;
        }
    }
    return isChanged;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:CodeCompletionOptionsPanelController.java

示例4: arePrefsChanged

import java.util.prefs.Preferences; //导入方法依赖的package包/类
private boolean arePrefsChanged(String mimeType, PreferencesCustomizer c) {
    boolean isChanged = false;
    Preferences prefs = selector.getCustomizerPreferences(c);
    Preferences savedPrefs = MimeLookup.getLookup(mimeType).lookup(Preferences.class);
    HashSet<String> hashSet = new HashSet<String>();
    try {
        hashSet.addAll(Arrays.asList(prefs.keys()));
        hashSet.addAll(Arrays.asList(savedPrefs.keys()));
    } catch (BackingStoreException ex) {
        return false;
    }
    for (String key : hashSet) {
        if (key.equals(FormattingPanelController.OVERRIDE_GLOBAL_FORMATTING_OPTIONS)) {
            continue;
        }
        isChanged |= (prefs.get(key, null) == null ? savedPrefs.get(key, null) != null : !prefs.get(key, null).equals(savedPrefs.get(key, null)))
                || (prefs.get(key, null) == null ? savedPrefs.get(key, null) != null : !prefs.get(key, null).equals(savedPrefs.get(key, null)));
    }
    return isChanged;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:FormattingPanelController.java

示例5: loadListData

import java.util.prefs.Preferences; //导入方法依赖的package包/类
@Override
protected void loadListData(JList list, String optionID, Preferences node) {
    DefaultListModel model = new DefaultListModel();
    String value = node.get(optionID, getDefaultAsString(optionID));
    for (String s : value.trim().split("\\s*[,;]\\s*")) { //NOI18N
        if (classMembersOrder.equals(optionID)) {
            Element e = new Element();
            if (s.startsWith("STATIC ")) { //NOI18N
                e.isStatic = true;
                s = s.substring(7);
            }
            e.kind = ElementKind.valueOf(s);
            model.addElement(e);
        } else {
            Visibility v = new Visibility();
            v.kind = s;
            model.addElement(v);
        }
    }
    list.setModel(model);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:FmtCodeGeneration.java

示例6: getSpi

import java.util.prefs.Preferences; //导入方法依赖的package包/类
protected @Override String getSpi(String key) {
    String bareKey;
    boolean returnValue;
    
    if (key.startsWith(JAVATYPE_KEY_PREFIX)) {
        bareKey = key.substring(JAVATYPE_KEY_PREFIX.length());
        returnValue = false;
    } else {
        bareKey = key;
        returnValue = true;
    }
    
    if (getLocal().containsKey(bareKey)) {
        TypedValue typedValue = getLocal().get(bareKey);
        return returnValue ? typedValue.getValue() : typedValue.getJavaType();
    } else {
        Preferences inheritedPrefs = getInherited();
        return inheritedPrefs != null ? inheritedPrefs.get(key, null) : null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:PreferencesImpl.java

示例7: removeFromPreferences

import java.util.prefs.Preferences; //导入方法依赖的package包/类
private void removeFromPreferences(ProjectInfo selectedItem) {
    Preferences p = Preferences.userNodeForPackage(this.getClass());
    String[] keys;
    try {
        keys = p.keys();
        for (int i = 0; i < keys.length; i++) {
            String key = keys[i];
            String fName = p.get(key, null);
            if (fName.equals(selectedItem.getFolder())) {
                p.remove(key);
                break;
            }
        }
    } catch (BackingStoreException e) {
        return;
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:18,代码来源:ProjectSelection.java

示例8: init

import java.util.prefs.Preferences; //导入方法依赖的package包/类
protected void init(){
    Preferences prefs = this.getPreferences();
    String flagString = prefs.get(PROP_FLAGS, CfgPreferencesDefaults.DEFAULT_FLAGSTRING);
    flagsSetting = new FlagsSetting(flagString);
    node_color = this.getColorProperty(PROP_NODE_COLOR, CfgPreferencesDefaults.DEFAUT_NODE_COLOR);
    background_color = this.getColorProperty(PROP_BACKGROUND_COLOR, CfgPreferencesDefaults.DEFAULT_BACKGROUND_COLOR); 
    backedge_color = this.getColorProperty(PROP_BACK_EDGE_COLOR, CfgPreferencesDefaults.DEFAULT_BACKEDGE_COLOR); 
    edge_color = this.getColorProperty(PROP_EDGE_COLOR, CfgPreferencesDefaults.DEFAULT_EDGE_COLOR);
    selection_color_fg= this.getColorProperty(PROP_SELECTION_COLOR_FG, CfgPreferencesDefaults.DEFAULT_SELECTION_COLOR_FOREGROUND);
    border_color = this.getColorProperty(PROP_BORDER_COLOR, CfgPreferencesDefaults.DEFAULT_BORDER_COLOR);
    exceptionEdgeColor = this.getColorProperty(PROP_EXCEPTION_EDGE_COLOR, CfgPreferencesDefaults.DEFAULT_EXCEPTIONEDGE_COLOR);
    text_color= this.getColorProperty(PROP_TEXT_COLOR, CfgPreferencesDefaults.DEFAULT_TEXT_COLOR);
    selection_color_bg = this.getColorProperty(PROP_SELECTION_COLOR_BG, CfgPreferencesDefaults.DEFAULT_SELECTION_COLOR_BACKGROUND);
    selection_color_fg = this.getColorProperty(PROP_SELECTION_COLOR_FG, CfgPreferencesDefaults.DEFAULT_SELECTION_COLOR_FOREGROUND);
    text_font = this.getFontProperty(PROP_TEXT_FONT, CfgPreferencesDefaults.DEFAULT_TEXT_FONT);     
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:17,代码来源:CfgPreferences.java

示例9: restoreRecentConnectionsList

import java.util.prefs.Preferences; //导入方法依赖的package包/类
void restoreRecentConnectionsList() {
    Preferences prefs = NbPreferences.forModule(ConnectionManager.class);
    synchronized (recentConnections) {
        recentConnections.clear();
        int idx = 0;
        while (true) {
            String id = prefs.get(getConnectoinsHistoryKey(idx), null);
            if (id == null) {
                break;
            }
            recentConnections.add(ExecutionEnvironmentFactory.fromUniqueID(id));
            idx++;
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ConnectionManager.java

示例10: ProfileProvider

import java.util.prefs.Preferences; //导入方法依赖的package包/类
ProfileProvider (@NonNull Context ctx) {
    final Preferences prefs = ctx.getSettings();
    final String profileName = prefs == null ?
            null :
            prefs.get(ProfilesCustomizerProvider.PROP_PROFILE_TO_CHECK, null);
    profile = profileName == null ?
            null :
            SourceLevelQuery.Profile.forName(profileName);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ProfilesAnalyzer.java

示例11: init

import java.util.prefs.Preferences; //导入方法依赖的package包/类
private void init() {
    Preferences prefs = NbPreferences.forModule(this.getClass());
    try {
        for (String kid:prefs.childrenNames()) {
            if (kid.startsWith(RULE_PREFIX)) {
                Preferences p = NbPreferences.forModule(this.getClass()).node(kid);
                String displayName = p.get("display.name", "unknown");
                create(kid.substring(RULE_PREFIX.length()), displayName);
            }
        }
    } catch (BackingStoreException ex) {
        Exceptions.printStackTrace(ex);
    }
    int configurationsVersion = prefs.getInt(KEY_CONFIGURATIONS_VERSION, 0);
    if (configs.isEmpty()) {
        create("default", NbBundle.getMessage(ConfigurationsManager.class, "DN_Default"));
        Configuration jdk7 = create("jdk7", NbBundle.getMessage(ConfigurationsManager.class, "DN_ConvertToJDK7"));
        jdk7.enable("Javac_canUseDiamond");
        jdk7.enable("org.netbeans.modules.java.hints.jdk.ConvertToStringSwitch");
        jdk7.enable("org.netbeans.modules.java.hints.jdk.ConvertToARM");
        jdk7.enable("org.netbeans.modules.java.hints.jdk.JoinCatches");
        // #215546 - requires user inspection
        // jdk7.enable("org.netbeans.modules.java.hints.jdk.UseSpecificCatch");
        //jdk7.enable("java.util.Objects");
    }
    if (configurationsVersion < 1 && !configurationExists("organizeImports")) {
        Configuration organizeImports = create("organizeImports", NbBundle.getMessage(ConfigurationsManager.class, "DN_OrganizeImports"));
        organizeImports.enable("org.netbeans.modules.java.hints.OrganizeImports");
    }
    prefs.putInt(KEY_CONFIGURATIONS_VERSION, CURRENT_CONFIGURATIONS_VERSION);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:ConfigurationsManager.java

示例12: getIndentEngine

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public static final IndentEngine getIndentEngine(MimePath mimePath) {
    IndentEngine eng = null;

    Preferences prefs = MimeLookup.getLookup(mimePath).lookup(Preferences.class);
    String handle = prefs.get(NbEditorDocument.INDENT_ENGINE, null);
    if (handle != null && handle.indexOf('.') == -1) { //NOI18N
        // looks like Lookup handle from previous version
        Lookup.Template<IndentEngine> query = new Lookup.Template(IndentEngine.class, handle, null);
        Collection<? extends IndentEngine> all = Lookup.getDefault().lookup(query).allInstances();
        if (!all.isEmpty()) {
            eng = all.iterator().next();
        }
    } else {
        eng = (IndentEngine) SettingsConversions.callFactory(prefs, mimePath, NbEditorDocument.INDENT_ENGINE, null);
    }
    
    if (eng == null) {
        EditorKit kit = MimeLookup.getLookup(mimePath).lookup(EditorKit.class);
        Object legacyFormatter = null;
        if (kit != null) {
            try {
                Method createFormatterMethod = kit.getClass().getDeclaredMethod("createFormatter"); //NOI18N
                legacyFormatter = createFormatterMethod.invoke(kit);
            } catch (Exception e) {
            }
        }
        if (legacyFormatter == null) {
            eng = new DefaultIndentEngine();
        }
    }

    return eng;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:ComplexValueSettingsFactory.java

示例13: getOnExpandAction

import java.util.prefs.Preferences; //导入方法依赖的package包/类
public OnExpandAction getOnExpandAction() {
    Preferences prefs = MimeLookup.getLookup(MimePath.EMPTY).lookup(Preferences.class);
    String action = prefs.get(CODE_TEMPLATE_ON_EXPAND_ACTION, null);
    if (action != null) {
        return OnExpandAction.valueOf(action);
    }
    return OnExpandAction.FORMAT;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:CodeTemplateSettingsImpl.java

示例14: createFromUserPreferences

import java.util.prefs.Preferences; //导入方法依赖的package包/类
/**
 * Charge les paramètres depuis les préférences utilisateur.
 * @return Parameters
 * @throws BackingStoreException e
 */
public static Parameters createFromUserPreferences() throws BackingStoreException {
	final Properties properties = new Properties();
	final Preferences prefs = Preferences.userNodeForPackage(Parameters.class);
	for (final String key : prefs.keys()) {
		final String value = prefs.get(key, null);
		if (value != null && !value.isEmpty()) {
			properties.put(key, value);
		}
	}
	return new Parameters(properties);
}
 
开发者ID:evernat,项目名称:dead-code-detector,代码行数:17,代码来源:Parameters.java

示例15: start

import java.util.prefs.Preferences; //导入方法依赖的package包/类
@Override
public void start(final Stage primaryStage) throws Exception
{
    primaryStage.initStyle(StageStyle.UNDECORATED);
    primaryStage.getIcons().add(new Image("/com/matthieu42/steamtradertools/bundles/images/Icon_STTBluepng.png"));
    Preferences prefs = Preferences.userNodeForPackage(com.matthieu42.steamtradertools.model.Main.class);
    String language = prefs.get(PreferencesKeys.LANGUAGE.toString(),Locale.ENGLISH.getDisplayLanguage());
    Locale locale;
    if(language.equals(Locale.FRENCH.getDisplayLanguage()))
    {
        locale = Locale.FRENCH;
    }
    else
        locale = Locale.ENGLISH;
    I18n.setLocale(locale);
    I18n.setBundle("com/matthieu42/steamtradertools/bundles/lang",locale);
    final AllAppList allAppList = new AllAppList();
    final UserAppList userAppList = new UserAppList();

    File steamAppList = new File("steamAppList.xml");
    if (!steamAppList.exists())
    {
        FXMLLoader splashLoader = new FXMLLoader(getClass().getResource("/com/matthieu42/steamtradertools/view/loadview.fxml"),I18n.getResourceBundle());
        AnchorPane pane = splashLoader.load();
        primaryStage.setScene(new Scene(pane));
        primaryStage.show();
        Task<Void> syncApp = allAppList.init();
        syncApp.setOnSucceeded(t ->
        {
            allAppList.saveToXml();
            continueLaunch(allAppList,userAppList,primaryStage);
        });

        syncApp.setOnFailed(t ->
        {
            return;
        });
        new Thread(syncApp).start();
    } else
    {
        allAppList.loadFromXml();
        continueLaunch(allAppList,userAppList,primaryStage);
    }
}
 
开发者ID:Matthieu42,项目名称:Steam-trader-tools,代码行数:45,代码来源:Main.java


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