Java Beans


DENNIS MANCL

Lucent Technologies
Bell Laboratories
Murray Hill, NJ 07974
mancl@lucent.com


The Java programming language


More about Java


Some Java history


Creating Java components


Java Beans


Java Bean conventions

/* file Thermometer.java */
public class Thermometer {
  /* these two functions define the "currentTemperature" property */
  public int getCurrentTemperature() { return temp; }
  public void setCurrentTemperature(int aTemp) { temp = aTemp; }

  private int temp;

  public void temperatureChanged(TempChangedEvent ev) { ... }
  ... other implementation details ...
}

Reflection in Java


More Java Bean configuration


Java code is generated by the Builder tools


Creating a Java Bean


Java Beans make good interfaces


Alternative ways to make a Java Bean

public class TemperatureBeanInfo extends java.beans.SimpleBeanInfo {
 /* the following function will return an array of PropertyDescriptor
    objects, one object per Java Bean property */
  public PropertyDescriptor[] getPropertyDescriptors() {
   ...
  }
}

Other ways to tailor a Java Bean


Using Java Beans for Web programs


Signed applets


Conclusion