List of usage examples for java.awt Component addPropertyChangeListener
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
From source file:org.objectstyle.cayenne.modeler.pref.ComponentGeometry.java
/** * Binds this preference object to synchronize its state with a given component * property.//w w w. j a v a2 s . c om */ public void bindIntProperty(final Component component, final String property, int defaultValue) { updateIntProperty(component, property, defaultValue); component.addPropertyChangeListener(property, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { Object value = e.getNewValue(); setProperty(property, value != null ? value.toString() : null); } }); }
From source file:com.mac.tarchan.desktop.event.EventQuery.java
/** * ???????/*from w ww.ja v a 2s .com*/ * * @param name ???????null ??????????? * @param target ? * @param action ????????????? * @param property ???????????? * @return ?? * @see PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) */ public EventQuery change(String name, Object target, String action, String property) { PropertyChangeListener propertyChange = EventHandler.create(PropertyChangeListener.class, target, action, property, "propertyChange"); for (Component child : list) { if (name != null) { child.addPropertyChangeListener(name, propertyChange); } else { child.addPropertyChangeListener(propertyChange); } } return this; }