本文整理匯總了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);
}
}
}
示例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));
}
}
}
}
示例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;
}
}
示例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);
}
}
}
示例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));
}
}
}
示例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));
}
}
}
示例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);
}
}
}