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

Variable Index

 o c
The Component this object is tracking.
 o code
The "hot key" for this component.
 o key
The "hot key" for this component.

Constructor Index

 o ComponentInfo(Component)
Constructor just stores component, and listens for keys on it.

Method Index

 o action()
The action key for this component has been pressed.
 o handleKey(KeyEvent)
Handle a key press we are interested in.
 o interested(KeyEvent)
Determine if this component is interested in a key press.
 o keyPressed(KeyEvent)
Handle a key press on the component.
 o setKeyFromText(String)
Utility function to extract the first capital letter from a String, and set the hot key to it.
 o setupDefaultBehaviour()
This should analyse the component, and set the default hot key for it.

Variables

 o c
 protected Component c
The Component this object is tracking.

 o key
 protected char key
The "hot key" for this component.

 o code
 protected int code
The "hot key" for this component.

Constructors

 o ComponentInfo
 public ComponentInfo(Component c)
Constructor just stores component, and listens for keys on it.

Methods

 o 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
 o interested
 public boolean interested(KeyEvent e)
Determine if this component is interested in a key press.

 o 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.

 o 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).

 o setKeyFromText
 public void setKeyFromText(String s)
Utility function to extract the first capital letter from a String, and set the hot key to it.

 o 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