|
Extension SDK | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.ide.controls.ItemSelectableTracker
The ItemSelectableTracker
is a simple class for
tracking the state of an ItemSelectable
, such as a
JCheckBox
or JToggleButton
so that a
dependent group of Components
can be enabled or
disabled when the state of the ItemSelectable
changes.
For example, this is commonly used in UI settings panels with radio buttons when there are other components associated with one or more of the buttons that should be enabled when the associated radio button is enabled, and disabled when the associated radio button is disabled.
Two optional overrides, itemSelected()
and
itemDeselected()
are provided in case clients need to
do additional work besides enabling or disabling dependent
components.
Note that this class is intended only for a check box or button type of item. It is not intended for a list type of item, such as the AWT List, JComboBox, or JList.
Field Summary | |
protected java.awt.Component[] |
components
Stores the dependent components to enable when item is enabled. |
Constructor Summary | |
ItemSelectableTracker(java.awt.ItemSelectable selectableItem,
java.awt.Component[] dependentComponents)
Constructs a new ItemSelectableTracker to listen to
the state of specified item, and enable or disable the specified
dependent components based on that state. |
|
ItemSelectableTracker(java.awt.ItemSelectable selectableItem,
java.awt.Component[] dependentComponents,
boolean sameEnabledState)
Constructs a new ItemSelectableTracker to listen to
the state of specified item, and enable or disable the specified
dependent components based on that state. |
Method Summary | |
protected void |
itemDeselected(java.awt.ItemSelectable item)
This method may be overrided by subclasses to take care of any additional work when the given item is deselected. |
protected void |
itemSelected(java.awt.ItemSelectable item)
This method may be overrided by subclasses to take care of any additional work when the given item is selected. |
void |
itemStateChanged(java.awt.event.ItemEvent event)
Invoked when an item has been selected or deselected. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.awt.Component[] components
Constructor Detail |
public ItemSelectableTracker(java.awt.ItemSelectable selectableItem, java.awt.Component[] dependentComponents)
ItemSelectableTracker
to listen to
the state of specified item, and enable or disable the specified
dependent components based on that state. This will also update
the enabled/disabled state of the dependent components to help
initialize dependents correctly.
selectableItem
- the ItemSelectable
, such as
a JCheckBox
to trackdependentComponents
- an array of Components
to
enable when the specified item is enabled - this array is
assumed to be non-changingpublic ItemSelectableTracker(java.awt.ItemSelectable selectableItem, java.awt.Component[] dependentComponents, boolean sameEnabledState)
ItemSelectableTracker
to listen to
the state of specified item, and enable or disable the specified
dependent components based on that state. This will also update
the enabled/disabled state of the dependent components to help
initialize dependents correctly.
selectableItem
- the ItemSelectable
, such as
a JCheckBox
to trackdependentComponents
- an array of Components
to
enable when the specified item is enabled - this array is
assumed to be non-changingsameEnabledState
- true
if the
dependentComponents
should have the same enabled state
as the selectableItem
. false
if the
state should reflect the opposite.Method Detail |
public final void itemStateChanged(java.awt.event.ItemEvent event)
itemStateChanged
in interface java.awt.event.ItemListener
event
- the ItemEvent objectprotected void itemSelected(java.awt.ItemSelectable item)
item
- the ItemSelectable
that was selectedprotected void itemDeselected(java.awt.ItemSelectable item)
item
- the ItemSelectable
that was deselected
|
Extension SDK | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright ©1997, 2003, Oracle. All rights reserved.