| Lesson 2 | Installing the JavaBeans Development Kit (BDK) |
| Objective | Install the JavaBeans Development Kit (BDK). |
getX/setX), events/listeners, persistence via Serializable, and design-time introspection.java.beans package (e.g., PropertyChangeSupport) remains useful in desktop apps and some libraries.< em>Only relevant if you are maintaining legacy labs or screenshots. Modern development does not require the BDK.
README file in the BDK root for version-specific notes.sh bdk_month_year.sh
records for immutable data.PropertyChangeSupport to publish change events.import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
public class Settings {
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
private int timeout;
public int getTimeout() { return timeout; }
public void setTimeout(int value) {
int old = this.timeout;
this.timeout = value;
pcs.firePropertyChange("timeout", old, value);
}
public void addPropertyChangeListener(PropertyChangeListener l) {
pcs.addPropertyChangeListener(l);
}
public void removePropertyChangeListener(PropertyChangeListener l) {
pcs.removePropertyChangeListener(l);
}
}
Suggested next reads: Java exceptions and error handling; Java threading basics; modern DI (Spring/Jakarta) vs classic JavaBeans.