All Packages Class Hierarchy This Package Previous Next Index
Class com.trumphurst.controls.ComponentInfo
java.lang.Object
|
+----java.awt.event.KeyAdapter
|
+----com.trumphurst.controls.ComponentInfo
- public class ComponentInfo
- extends KeyAdapter
Class to describe and implement the reaction of a component to key presses.
Each type of component has a corresponding ComponentInfo class.
If you create your own Components, you may subclass ComponentInfo to provide
the correct behaviour.
- See Also:
- ContainerKeyTracker
-
c
- The Component this object is tracking.
-
code
- The "hot key" for this component.
-
key
- The "hot key" for this component.
-
ComponentInfo(Component)
- Constructor just stores component, and listens for keys on it.
-
action()
- The action key for this component has been pressed.
-
handleKey(KeyEvent)
- Handle a key press we are interested in.
-
interested(KeyEvent)
- Determine if this component is interested in a key press.
-
keyPressed(KeyEvent)
- Handle a key press on the component.
-
setKeyFromText(String)
- Utility function to extract the first capital letter from a String,
and set the hot key to it.
-
setupDefaultBehaviour()
- This should analyse the component, and set the default hot key for it.
c
protected Component c
- The Component this object is tracking.
key
protected char key
- The "hot key" for this component.
code
protected int code
- The "hot key" for this component.
ComponentInfo
public ComponentInfo(Component c)
- Constructor just stores component, and listens for keys on it.
keyPressed
public void keyPressed(KeyEvent e)
- Handle a key press on the component.
If the component is not interested in the key, it must pass it to its container.
This default implementation does so.
- Overrides:
- keyPressed in class KeyAdapter
interested
public boolean interested(KeyEvent e)
- Determine if this component is interested in a key press.
handleKey
public void handleKey(KeyEvent e)
- Handle a key press we are interested in.
Sets the focus to the component (or to the next traversable component
after it), and then calls action.
action
public void action()
- The action key for this component has been pressed.
Do whatever it is supposed to do (press the button, or whatever).
setKeyFromText
public void setKeyFromText(String s)
- Utility function to extract the first capital letter from a String,
and set the hot key to it.
setupDefaultBehaviour
public void setupDefaultBehaviour()
- This should analyse the component, and set the default hot key for it.
All Packages Class Hierarchy This Package Previous Next Index