org.jdesktop.swingx.plaf.AbstractUIChangeHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swingx-all Show documentation
Show all versions of swingx-all Show documentation
A Maven project to aggregate all modules into a single artifact.
The newest version!
package org.jdesktop.swingx.plaf;
import java.beans.PropertyChangeListener;
import java.util.Map;
import java.util.WeakHashMap;
import javax.swing.JComponent;
@SuppressWarnings("nls")
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);
}
}