| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.swinglib.field.FieldWatcher
public class FieldWatcher
Tracks input field changes. This is normally used by dialogs, to automatically enable/disable an "OK" button based on whether the user has made changes.
  To use, create a single instance for the dialog, and attach all fields of
  interest. When the dialog is displayed, call reset(). You can either
  manually interrogate the listener for changes, or have it automatically
  enable/disable one or more buttons.
  
An alternate usage is to create a watcher on a single field (normally a checkbox), and use it to enable/disable a group of related fields. For example, add a checkbox to enter a billing address, then enable/disable the address fields depending on whether the box is checked.
At present, this watcher knows how to track the following field types:
JTextComponent
  JToggleButton)
  JList
  reset() is called.
| Constructor Summary | |
|---|---|
| FieldWatcher(Action... controlled)Creates an instance with zero or more controlled actions. | |
| FieldWatcher(JComponent... controlled)Creates an instance with zero or more controlled components. | |
| Method Summary | |
|---|---|
|  FieldWatcher | addControlled(Action controlled)Adds a controlled action after construction. | 
|  FieldWatcher | addControlled(JComponent controlled)Adds a controlled component after construction. | 
|  FieldWatcher | addValidatedField(JTextComponent theField,
                  FieldValidator validator)Adds a validated field to the watch list. | 
|  FieldWatcher | addWatchedField(JComponent theField)Adds a field to the watch list. | 
|  Collection<JComponent> | getChangedComponents()Returns the components that have changed since construction or the last call to reset(). | 
|  void | reset()Resets this watcher: clears the list of changed fields, and disables any controlled components. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public FieldWatcher(JComponent... controlled)
reset() is called, enabled when a watched field
  changes.
public FieldWatcher(Action... controlled)
reset() is called, enabled when a watched field
  changes.
| Method Detail | 
|---|
public FieldWatcher addControlled(JComponent controlled)
public FieldWatcher addControlled(Action controlled)
public FieldWatcher addWatchedField(JComponent theField)
public FieldWatcher addValidatedField(JTextComponent theField,
                                      FieldValidator validator)
public Collection<JComponent> getChangedComponents()
reset().
public void reset()
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||