Designing Class Libraries for Visual Builders

By Arthur T. Jolin, David Lavin, and Susan Carpenter

Dr. Dobb's Journal June 1998

public class Address implements java.lang.Cloneable {
String fieldStreet = "";
protected transient java.beans.PropertyChangeSupport propertyChange = new
        java.beans.PropertyChangeSupport(this);
String fieldState = "";
String fieldCity = "";
String fieldZipCode = "";
 ...
/* Sets the street property (java.lang.String) value.
 * @param street The new value for the property.
 * @see #getStreet
 */
public void setStreet(String street) {
 /* Get the old property value for fire property change event. */
 String oldValue = fieldStreet;
 /* Set the street property (attribute) to the new value. */
 fieldStreet = street;
 /* Fire (signal/notify) the street property change event. */
 firePropertyChange("street", oldValue, street);
 return;
}
 ...
}

Example 2: Code enabling Address for notification.

Back to Article


Copyright © 1998, Dr. Dobb's Journal