org.jvnet.substance.utils
Class CompositeButtonModel

java.lang.Object
  extended by javax.swing.DefaultButtonModel
      extended by org.jvnet.substance.utils.CompositeButtonModel
All Implemented Interfaces:
java.awt.ItemSelectable, java.io.Serializable, javax.swing.ButtonModel

public class CompositeButtonModel
extends javax.swing.DefaultButtonModel

Composite button model that tracks changes to one primary and any number of secondary button models for composite rollover effects. This model can be used to "simulate" rollover effects on the primary component when the actual rollover happens on one of the secondary components. An example is a scroll bar. When the mouse enters one of the scroll buttons, the scroll track is highlighted as well.

Author:
Kirill Grouchnikov
See Also:
Serialized Form

Field Summary
protected  javax.swing.ButtonModel primaryModel
          The primary model.
protected  javax.swing.ButtonModel[] secondaryModels
          The secondary models.
 
Fields inherited from class javax.swing.DefaultButtonModel
actionCommand, ARMED, changeEvent, ENABLED, group, listenerList, mnemonic, PRESSED, ROLLOVER, SELECTED, stateMask
 
Constructor Summary
CompositeButtonModel(javax.swing.ButtonModel primaryModel, javax.swing.AbstractButton... secondaryButtons)
          Creates a new composite button model.
CompositeButtonModel(javax.swing.ButtonModel primaryModel, javax.swing.ButtonModel... secondaryModels)
          Creates a new composite button model.
 
Method Summary
 boolean isArmed()
           
 boolean isEnabled()
           
 boolean isPressed()
           
 boolean isRollover()
           
 boolean isSelected()
           
 
Methods inherited from class javax.swing.DefaultButtonModel
addActionListener, addChangeListener, addItemListener, fireActionPerformed, fireItemStateChanged, fireStateChanged, getActionCommand, getActionListeners, getChangeListeners, getGroup, getItemListeners, getListeners, getMnemonic, getSelectedObjects, removeActionListener, removeChangeListener, removeItemListener, setActionCommand, setArmed, setEnabled, setGroup, setMnemonic, setPressed, setRollover, setSelected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

primaryModel

protected javax.swing.ButtonModel primaryModel
The primary model.


secondaryModels

protected javax.swing.ButtonModel[] secondaryModels
The secondary models.

Constructor Detail

CompositeButtonModel

public CompositeButtonModel(javax.swing.ButtonModel primaryModel,
                            javax.swing.ButtonModel... secondaryModels)
Creates a new composite button model.

Parameters:
primaryModel - The primary model.
secondaryModels - The secondary models.

CompositeButtonModel

public CompositeButtonModel(javax.swing.ButtonModel primaryModel,
                            javax.swing.AbstractButton... secondaryButtons)
Creates a new composite button model.

Parameters:
primaryModel - The primary model.
secondaryButtons - The secondary buttons.
Method Detail

isRollover

public boolean isRollover()
Specified by:
isRollover in interface javax.swing.ButtonModel
Overrides:
isRollover in class javax.swing.DefaultButtonModel

isArmed

public boolean isArmed()
Specified by:
isArmed in interface javax.swing.ButtonModel
Overrides:
isArmed in class javax.swing.DefaultButtonModel

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface javax.swing.ButtonModel
Overrides:
isEnabled in class javax.swing.DefaultButtonModel

isPressed

public boolean isPressed()
Specified by:
isPressed in interface javax.swing.ButtonModel
Overrides:
isPressed in class javax.swing.DefaultButtonModel

isSelected

public boolean isSelected()
Specified by:
isSelected in interface javax.swing.ButtonModel
Overrides:
isSelected in class javax.swing.DefaultButtonModel