Java 8 PreferenceChangeEvent - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 PreferenceChangeEvent class.

This code example shows how to use the following methods: getSource, getKey, getNewValue, getNode
        assertSame(Preferences.userRoot(), event.getSource());
    } 
 
    public void testConstructor() { 
        event = new PreferenceChangeEvent(Preferences.userRoot(), "key",
        "value"); 
        assertEquals("key", event.getKey());
        assertEquals("value", event.getNewValue());
        assertSame(Preferences.userRoot(), event.getNode());
        assertSame(Preferences.userRoot(), event.getSource());
    } 
 
    public void testSerialization() throws Exception { 
        event = new PreferenceChangeEvent(Preferences.userRoot(), "key",
        "value"); 
        try { 
            SerializationTest.copySerializable(event);
            fail("No expected NotSerializableException");
        } catch (NotSerializableException e) {
        } 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
        super.setUp(); 
        l = new PreferenceChangeListenerImpl();
    } 
 
    public void testPreferenceChange() { 
        l.preferenceChange(new PreferenceChangeEvent(Preferences.userRoot(),
                "", "")); 
    } 
 
    public static class PreferenceChangeListenerImpl implements 
    PreferenceChangeListener {
        public void preferenceChange(PreferenceChangeEvent pce) {
        } 
 
    } 
 
} 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getKey, getNewValue, getNode
        } 
        return arrayLastProjFiles;
    } 
 
    public void preferenceChange(PreferenceChangeEvent evt) {
        evt.getNode().put(evt.getKey(), evt.getNewValue());
    } 
} 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getKey, getNode
			AppPreferences.getPrefs().putBoolean(getIdentifier(), newVal);
		} 
	} 
 
	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);
			} 
		} 
	} 
} 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getKey, getNode
			AppPreferences.getPrefs().put(getIdentifier(), newValue);
		} 
	} 
 
	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);
			} 
		} 
	} 
	 
	private static boolean isSame(String a, String b) {
		return a == null ? b == null : a.equals(b);
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
See Code Examples for Java 8 PreferenceChangeEvent Methods: