Class edu.cornell.lassp.mck10.ConfigurePack.ConfigureTextField
All Packages Class Hierarchy This Package Previous Next Index
Class edu.cornell.lassp.mck10.ConfigurePack.ConfigureTextField
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.TextComponent
|
+----java.awt.TextField
|
+----edu.cornell.lassp.mck10.ConfigurePack.ConfigureTextField
- public class ConfigureTextField
- extends TextField
- implements Observer, Runnable
The ConfigureTextField class provides a generic text box, which
is designed to modify and reflect the values of Configurable variables.
it can be used with any type of Configurable variable, because it
only interacts with the variable through the set(String) and
toString() methods.
Source code
is available.
- Version:
- 0.1
- Author:
- Matt Kuntz (E-mail: mck10@cornell.edu)
- See Also:
- Configurable
-
ConfigureTextField(Configurable)
-
The ConfigureTextField(Configurable) constructor accepts a
Configurable as its only parameter.
-
ConfigureTextField(Configurable, int)
-
The ConfigureTextField(Configurable,int) constructor accepts a
Configurable variable as its first parameter, and the desired number
of columns in the Text Field as the second parameter.
-
action(Event, Object)
-
The action(Event,Object) method has been overridden so that
the value of the internal variable will be changed to the value typed
in the text box when the
Enter key is pressed.
-
keyDown(Event, int)
-
The keyDown(Event,int) method is overridden so that the text
will change to red when the text is being edited, and so that the
ESC key will restore the textbox to displaying the value of its internal
variable.
-
newConfigurable(Configurable)
-
The newConfigurable(Configurable) is used to reattach the
text field to a new Configurable variable.
-
run()
-
run() is called when the action method creates a new
thread.
-
setEditable(boolean)
-
The setEditable(boolean) method of TextField has been overriden
to change the color scheme.
-
update(Observable, Object)
-
The update(Observable,obj) method required by the
Observer interface is used to cause the edit-box to
change when its variable's value changes.
-
watch(boolean)
-
ConfigureTextField
public ConfigureTextField(Configurable var)
- The ConfigureTextField(Configurable) constructor accepts a
Configurable as its only parameter. It ties its text to this
Configurable.
- Parameters:
- var - The Configurable variable to tie the TextField to.
ConfigureTextField
public ConfigureTextField(Configurable var,
int cols)
- The ConfigureTextField(Configurable,int) constructor accepts a
Configurable variable as its first parameter, and the desired number
of columns in the Text Field as the second parameter.
- Parameters:
- var - A configurable variable to attach the field to.
- cols - The number of columns in the text field.
newConfigurable
public void newConfigurable(Configurable var)
- The newConfigurable(Configurable) is used to reattach the
text field to a new Configurable variable.
- Parameters:
- var - The new configurable variable.
setEditable
public void setEditable(boolean t)
- The setEditable(boolean) method of TextField has been overriden
to change the color scheme.
- Parameters:
- t - Is the box editable,
true or false?
- Overrides:
- setEditable in class TextComponent
update
public void update(Observable obs,
Object obj)
- The update(Observable,obj) method required by the
Observer interface is used to cause the edit-box to
change when its variable's value changes.
- Parameters:
- obs - The observable variable which has changed.
- obj - An arbitrary parameter which is not used here.
keyDown
public boolean keyDown(Event evt,
int key)
- The keyDown(Event,int) method is overridden so that the text
will change to red when the text is being edited, and so that the
ESC key will restore the textbox to displaying the value of its internal
variable.
- Parameters:
- evt - The event.
- key - The key which was pressed.
- Overrides:
- keyDown in class Component
action
public synchronized boolean action(Event evt,
Object whichAction)
- The action(Event,Object) method has been overridden so that
the value of the internal variable will be changed to the value typed
in the text box when the
Enter key is pressed.
- Overrides:
- action in class Component
run
public synchronized void run()
-
run() is called when the action method creates a new
thread. The changing of the Configurable's value happens here,
to avoid tying up the user interface for too long.
watch
public void watch(boolean t)
All Packages Class Hierarchy This Package Previous Next Index