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


Java PreferenceChangeEvent.getNode方法代碼示例

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


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

示例1: preferenceChange

import java.util.prefs.PreferenceChangeEvent; //導入方法依賴的package包/類
@Override
public void preferenceChange(PreferenceChangeEvent event) {
	Preferences prefs = event.getNode();
	String prop = event.getKey();
	String name = getIdentifier();
	if (prop.equals(name)) {
		String oldValue = value;
		String newValue = prefs.get(name, dflt);
		if (!isSame(oldValue, newValue)) {
			String[] o = opts;
			String chosen = null;
			for (int i = 0; i < o.length; i++) {
				if (isSame(o[i], newValue)) {
					chosen = o[i];
					break;
				}
			}
			if (chosen == null)
				chosen = dflt;
			value = chosen;
			AppPreferences.firePropertyChange(name, oldValue, chosen);
		}
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:25,代碼來源:PrefMonitorStringOpts.java

示例2: preferenceChange

import java.util.prefs.PreferenceChangeEvent; //導入方法依賴的package包/類
@Override
public void preferenceChange(PreferenceChangeEvent event) {
	Preferences prefs = event.getNode();
	String prop = event.getKey();
	if (prop.startsWith(BASE_PROPERTY)) {
		String rest = prop.substring(BASE_PROPERTY.length());
		int index = -1;
		try {
			index = Integer.parseInt(rest);
			if (index < 0 || index >= NUM_RECENT)
				index = -1;
		} catch (NumberFormatException e) {
		}
		if (index >= 0) {
			File oldValue = recentFiles[index];
			long oldTime = recentTimes[index];
			getAndDecode(prefs, index);
			File newValue = recentFiles[index];
			long newTime = recentTimes[index];
			if (!isSame(oldValue, newValue) || oldTime != newTime) {
				AppPreferences.firePropertyChange(AppPreferences.RECENT_PROJECTS, new FileTime(oldValue, oldTime),
						new FileTime(newValue, newTime));
			}
		}
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:27,代碼來源:RecentProjects.java

示例3: preferenceChange

import java.util.prefs.PreferenceChangeEvent; //導入方法依賴的package包/類
@Override
public void preferenceChange(PreferenceChangeEvent evt) {
    if (suppressPrefChanges == Boolean.TRUE) {
        return;
    }
    boolean ch = detectIsChanged();
    MemoryPreferences defMime;
    synchronized (preferences) {
        defMime = preferences.get(""); // NOI18N
    }
    if (defMime != null && defMime.getPreferences() == evt.getNode()) {
        if (FoldUtilitiesImpl.PREF_CODE_FOLDING_ENABLED.equals(evt.getKey())) {
            // propagate to all preferences, suppress events
            suppressPrefChanges = true;
            Collection<MemoryPreferences> col;
            
            synchronized (preferences) {
                col = new ArrayList<>(preferences.values());
            }
            try {
                for (MemoryPreferences p : col) {
                    if (p != defMime) {
                        if (((OverridePreferences)p.getPreferences()).isOverriden(FoldUtilitiesImpl.PREF_CODE_FOLDING_ENABLED)) {
                            p.getPreferences().remove(FoldUtilitiesImpl.PREF_CODE_FOLDING_ENABLED);
                        }
                    } 
                }
            } finally {
                suppressPrefChanges = false;
            }
        }
    }
    if (ch != changed) {
        propSupport.firePropertyChange(PROP_CHANGED, !ch, ch);
        changed = true;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:38,代碼來源:FoldOptionsController.java

示例4: preferenceChange

import java.util.prefs.PreferenceChangeEvent; //導入方法依賴的package包/類
@Override
public void preferenceChange(PreferenceChangeEvent event) {
	Preferences prefs = event.getNode();
	String prop = event.getKey();
	String name = getIdentifier();
	if (prop.equals(name)) {
		boolean oldValue = value;
		boolean newValue = prefs.getBoolean(name, dflt);
		if (newValue != oldValue) {
			value = newValue;
			AppPreferences.firePropertyChange(name, oldValue, newValue);
		}
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:15,代碼來源:PrefMonitorBoolean.java

示例5: preferenceChange

import java.util.prefs.PreferenceChangeEvent; //導入方法依賴的package包/類
@Override
public void preferenceChange(PreferenceChangeEvent event) {
	Preferences prefs = event.getNode();
	String prop = event.getKey();
	String name = getIdentifier();
	if (prop.equals(name)) {
		double oldValue = value;
		double newValue = prefs.getDouble(name, dflt);
		if (newValue != oldValue) {
			value = newValue;
			AppPreferences.firePropertyChange(name, Double.valueOf(oldValue), Double.valueOf(newValue));
		}
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:15,代碼來源:PrefMonitorDouble.java

示例6: preferenceChange

import java.util.prefs.PreferenceChangeEvent; //導入方法依賴的package包/類
@Override
public void preferenceChange(PreferenceChangeEvent event) {
	Preferences prefs = event.getNode();
	String prop = event.getKey();
	String name = getIdentifier();
	if (prop.equals(name)) {
		int oldValue = value;
		int newValue = prefs.getInt(name, dflt);
		if (newValue != oldValue) {
			value = newValue;
			AppPreferences.firePropertyChange(name, Integer.valueOf(oldValue), Integer.valueOf(newValue));
		}
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:15,代碼來源:PrefMonitorInt.java

示例7: preferenceChange

import java.util.prefs.PreferenceChangeEvent; //導入方法依賴的package包/類
@Override
public void preferenceChange(PreferenceChangeEvent event) {
	Preferences prefs = event.getNode();
	String prop = event.getKey();
	String name = getIdentifier();
	if (prop.equals(name)) {
		String oldValue = value;
		String newValue = prefs.get(name, dflt);
		if (!isSame(oldValue, newValue)) {
			value = newValue;
			AppPreferences.firePropertyChange(name, oldValue, newValue);
		}
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:15,代碼來源:PrefMonitorString.java


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