All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jdesktop.swingx.plaf.AbstractUIChangeHandler Maven / Gradle / Ivy

The newest version!
package org.jdesktop.swingx.plaf;

import java.beans.PropertyChangeListener;
import java.util.Map;
import java.util.WeakHashMap;

import javax.swing.JComponent;

public abstract class AbstractUIChangeHandler implements PropertyChangeListener {
	//prevent double installation.
	private final Map installed = new WeakHashMap();
	
	public void install(JComponent c){
		if(isInstalled(c)){
			return;
		}
		
		c.addPropertyChangeListener("UI", this);
		installed.put(c, Boolean.FALSE);
	}
	
	public boolean isInstalled(JComponent c) {
		return installed.containsKey(c);
	}

	public void uninstall(JComponent c){
		c.removePropertyChangeListener("UI", this);
		installed.remove(c);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy