Java Beans
Java Beans
Example:-
Swing are all the Java Bean component
Component (Button,TextField,Label)
Java Bean classes follow certain Rule or Condition.
All java Bean classes must Implement the
Serializable
Interface.
Component may be used by some
application builder.
Class Object
Serializing
Component
Object
CLASS
GUI based
Component
Boolean Properties
Indexed Properties
1 Simple Properties:-
Represent a single value.
The accessor methods should follow standard
naming conventions.
public <PropertyType> get<PropertyName>();
public void set<PropertyName>(<PropertyType> value);
Example:
Example:
Example:
public Color setPalette(int index);
public void setPalette(int index,Color value);
public Color[] getPalette();
public void setPalette(Color[] values);
Bound:-
a bound property notifies other objects when its
value changes
generates a PropertyChange event with property
name, old value and new value
Constrained:-
an object with constrained properties allows other
objects to veto a constrained property value
change
Constrained property listeners can veto a change
by
throwing a PropertyVetoException
Two types of objects are involved:
“Source” objects.
“Listener” objects.