All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sunw.demo.jelly.JellyBean

java.lang.Object
   |
   +----java.awt.Component
           |
           +----sunw.demo.jelly.JellyBean

public class JellyBean
extends Component
A simple bean with bound properties and one constrained property. The constrained property is "priceInCents". VetoablePropertyChange listeners can reject a proposed value for this property by throwing a PropertyVetoException.

See Also:
Voter

Constructor Index

 o JellyBean()
Construct a smallish JellyBean.

Method Index

 o addPropertyChangeListener(PropertyChangeListener)
The specified PropertyChangeListeners propertyChange method will be called each time the value of any bound property is changed.
 o addVetoableChangeListener(VetoableChangeListener)
The specified VetoableChangeListeners vetoableChange method will be called each time the value of any constrained property is changed.
 o getColor()
Returns the color that the jelly bean is rendered with.
 o getPreferredSize()
 o getPriceInCents()
Returns the current price.
 o paint(Graphics)
 o removePropertyChangeListener(PropertyChangeListener)
Remove this PropertyChangeListener from the JellyBeans internal list.
 o removeVetoableChangeListener(VetoableChangeListener)
Remove this VetoableChangeListener from the JellyBeans internal list.
 o setColor(Color)
Sets the color that the jelly bean is rendered with.
 o setPriceInCents(int)
Set the price in cents unless one of the VetoableChangeListeners throws a PropertyVetoException.

Constructors

 o JellyBean
 public JellyBean()
Construct a smallish JellyBean.

Methods

 o paint
 public void paint(Graphics g)
Overrides:
paint in class Component
 o getPreferredSize
 public Dimension getPreferredSize()
Overrides:
getPreferredSize in class Component
 o getColor
 public synchronized Color getColor()
Returns the color that the jelly bean is rendered with.

See Also:
setColor
 o setColor
 public void setColor(Color newColor)
Sets the color that the jelly bean is rendered with. This is a bound property.

See Also:
getColor
 o getPriceInCents
 public synchronized int getPriceInCents()
Returns the current price.

See Also:
setPriceInCents
 o setPriceInCents
 public void setPriceInCents(int newPriceInCents) throws PropertyVetoException
Set the price in cents unless one of the VetoableChangeListeners throws a PropertyVetoException. This is a constrained property.

Throws: PropertyVetoException
if the proposed price was vetoed
 o addPropertyChangeListener
 public void addPropertyChangeListener(PropertyChangeListener l)
The specified PropertyChangeListeners propertyChange method will be called each time the value of any bound property is changed. The PropertyListener object is addded to a list of PropertyChangeListeners managed by the JellyBean, it can be removed with removePropertyChangeListener. Note: the JavaBeans specification does not require PropertyChangeListeners to run in any particular order.

Parameters:
l - the PropertyChangeListener
See Also:
removePropertyChangeListener
 o removePropertyChangeListener
 public void removePropertyChangeListener(PropertyChangeListener l)
Remove this PropertyChangeListener from the JellyBeans internal list. If the PropertyChangeListener isn't on the list, silently do nothing.

Parameters:
l - the PropertyChangeListener
See Also:
addPropertyChangeListener
 o addVetoableChangeListener
 public void addVetoableChangeListener(VetoableChangeListener l)
The specified VetoableChangeListeners vetoableChange method will be called each time the value of any constrained property is changed. Currently, the only constrained property is "priceInCents". The VetoableChangeListener object is addded to a list of VetoableChangeListeners managed by the JellyBean, it can be removed with removeVetoableChangeListener. Note: the JavaBeans specification does not require VetoableChangeListeners to run in any particular order.

Parameters:
l - the VetoableChangeListener
See Also:
removeVetoableChangeListener
 o removeVetoableChangeListener
 public void removeVetoableChangeListener(VetoableChangeListener l)
Remove this VetoableChangeListener from the JellyBeans internal list. If the VetoableChangeListener isn't on the list, silently do nothing.

Parameters:
l - the VetoableChangeListener
See Also:
addVetoableChangeListener

All Packages  Class Hierarchy  This Package  Previous  Next  Index