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
-
JellyBean()
- Construct a smallish JellyBean.
-
addPropertyChangeListener(PropertyChangeListener)
- The specified PropertyChangeListeners propertyChange method will
be called each time the value of any bound property is changed.
-
addVetoableChangeListener(VetoableChangeListener)
- The specified VetoableChangeListeners vetoableChange method will
be called each time the value of any constrained property is changed.
-
getColor()
-
Returns the color that the jelly bean is rendered with.
-
getPreferredSize()
-
-
getPriceInCents()
-
Returns the current price.
-
paint(Graphics)
-
-
removePropertyChangeListener(PropertyChangeListener)
-
Remove this PropertyChangeListener from the JellyBeans internal list.
-
removeVetoableChangeListener(VetoableChangeListener)
-
Remove this VetoableChangeListener from the JellyBeans internal list.
-
setColor(Color)
-
Sets the color that the jelly bean is rendered with.
-
setPriceInCents(int)
- Set the price in cents unless one of the VetoableChangeListeners
throws a PropertyVetoException.
JellyBean
public JellyBean()
- Construct a smallish JellyBean.
paint
public void paint(Graphics g)
- Overrides:
- paint in class Component
getPreferredSize
public Dimension getPreferredSize()
- Overrides:
- getPreferredSize in class Component
getColor
public synchronized Color getColor()
- Returns the color that the jelly bean is rendered with.
- See Also:
- setColor
setColor
public void setColor(Color newColor)
- Sets the color that the jelly bean is rendered with. This is a
bound property.
- See Also:
- getColor
getPriceInCents
public synchronized int getPriceInCents()
- Returns the current price.
- See Also:
- setPriceInCents
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
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
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
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
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