All Packages Class Hierarchy This Package Previous Next Index
Class symantec.itools.awt.KeyPressManagerPanel
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----symantec.itools.awt.KeyPressManagerPanel
- public class KeyPressManagerPanel
- extends Panel
A Panel extension which provides for
tabbing between components and supporting certain key accelerations
by posting events provided by the user. Can be used directly or extended.
When extending be sure to super()
during construction and to super.handleEvent(evt) from
handleEvent if you override it.
The tab focus order is based on the order in which the components were
added to the panel. Each component receives
focus in turn, but the mouse cursor is not relocated. Look at the Project
window to see the tab order of components within the KeyPressManagerPanel.
You can change the tab order by moving the component names in the Project
window list, or by adding them to the panel in a different order in your
source code.
Components respond to default events when they receive focus. For example,
the TextField component displays text input from the keyboard, and the
Button component issues an action event when it is clicked.
Use KeyPressManagerPanel to create a panel whose elements can be tabbed
through, and specifically to:
- ╖ Create a subcontainer that organizes container space within an Applet,
Frame or Dialog container. This simplifies your component layout task.
- ╖ Hold other specialized Panel containers.
-
CTRL
- A constant that indicates CTRL was pressed with a key.
-
PLAIN
- A constant that indicates no modifier keys (SHIFT,CTRL) were pressed with a key.
-
SHIFT
- A constant that indicates SHIFT was pressed with a key.
-
KeyPressManagerPanel()
- Constructs a Panel which handles key press events.
-
add(Component)
- Adds a component to the end of this container.
-
getAutoTabState()
- Gets the current automatic tab state.
-
getTabToTextComponetsOnly()
- Gets whether tabbing is to TextComponents only.
-
handleEvent(Event)
- Processes events for this component.
-
removeCancelButton()
- Removes Escape key association with current Cancel button/event
-
removeDefaultButton()
- Removes Enter/Return key association with current default
button/event.
-
removeFKeyEvent(int)
- Removes association of an event with a Function key press
-
removeFKeyEvent(int, int)
- Removes association of an event with a Function key press
-
resetKeyManager()
- Resets all KeyPressManager associations (default button, cancel
button, tab stop list).
-
setAutoTabState(boolean)
- Sets the automatic tab state.
-
setCancelButton(Button)
- Sets the button to press when the Escape key is pressed.
-
setCancelButton(Button, Event, Container, boolean)
- Associates a button and an event with pressing the Escape key.
-
setDefaultButton(Button)
- Sets the button to press when the Enter or Return key
is pressed.
-
setDefaultButton(Button, Event, Container, boolean)
- Associates a button and an event with pressing the Enter/Return key.
-
setFKeyEvent(int, Event, Container)
- Associates an event with pressing a Function key.
-
setFKeyEvent(int, int, Event, Container)
- Associates an event with a modified Function key press.
-
setTabStop(Component)
- Allows tabbing to the specified component.
-
setTabToTextComponetsOnly(boolean)
- Sets whether tabs should only change focus to TextComponents.
PLAIN
public final static int PLAIN
- A constant that indicates no modifier keys (SHIFT,CTRL) were pressed with a key.
SHIFT
public final static int SHIFT
- A constant that indicates SHIFT was pressed with a key.
CTRL
public final static int CTRL
- A constant that indicates CTRL was pressed with a key.
KeyPressManagerPanel
public KeyPressManagerPanel()
- Constructs a Panel which handles key press events.
By default, components added to this panel can be tabbed to. To change
this call method setAutoTabState() with false before adding components
that can't be tabbed to.
setAutoTabState
public void setAutoTabState(boolean bNewTabState)
- Sets the automatic tab state.
When this is true added components can be tabbed to.
Note: this needs to be set before the add() method is called.
- Parameters:
- bNewTabState - the new automatic tab state
- See Also:
- getAutoTabState, add
getAutoTabState
public boolean getAutoTabState()
- Gets the current automatic tab state.
When this is true added components can be tabbed to.
- Returns:
- the current automatic tab state value
- See Also:
- setAutoTabState
setTabToTextComponetsOnly
public void setTabToTextComponetsOnly(boolean bNewOnlyTabToTextComponents)
- Sets whether tabs should only change focus to TextComponents.
This is defaulted to true for Macintosh.
- Parameters:
- bNewOnlyTabToTextComponents - new tab to TextComponents only state
- See Also:
- getTabToTextComponetsOnly
getTabToTextComponetsOnly
public boolean getTabToTextComponetsOnly()
- Gets whether tabbing is to TextComponents only.
This is defaulted to true for Macintosh.
- Returns:
- true if tabbing is to TextComponents only
- See Also:
- setTabToTextComponetsOnly
handleEvent
public synchronized boolean handleEvent(Event evt)
- Processes events for this component.
This is a standard Java AWT method which gets called by the AWT
to handle this component's events. The default handler for
components dispatches to one of the following methods as needed:
action(), gotFocus(), lostFocus(), keyDown(), keyUp(), mouseEnter(),
mouseExit(), mouseMove(), mouseDrag(), mouseDown(), or mouseUp().
- Parameters:
- evt - the event to handle
- Returns:
- true if the event was handled and no further action is needed,
false to pass the event to this component's parent
- Overrides:
- handleEvent in class Component
- See Also:
- action, gotFocus, lostFocus, keyDown, keyUp, mouseEnter, mouseExit, mouseMove, mouseDrag, mouseDown, mouseUp
resetKeyManager
public void resetKeyManager()
- Resets all KeyPressManager associations (default button, cancel
button, tab stop list).
add
public Component add(Component component)
- Adds a component to the end of this container.
This is a standard Java AWT method which gets called to add a
component to a container. The specified component is added to
the end of this container.
If auto-tab enabled (the default)
it also adds the component to the tab stop list.
- Parameters:
- component - the component to add
- Returns:
- the added component
- Overrides:
- add in class Container
- See Also:
- remove
removeDefaultButton
public void removeDefaultButton()
- Removes Enter/Return key association with current default
button/event.
- See Also:
- setDefaultButton
setTabStop
public void setTabStop(Component component)
- Allows tabbing to the specified component.
Adds the component to the tab stop list.
- Parameters:
- component - the component to be able to tab to
setDefaultButton
public void setDefaultButton(Button button)
- Sets the button to press when the Enter or Return key
is pressed.
- Parameters:
- button - the button to set as default
- See Also:
- removeDefaultButton
setDefaultButton
public void setDefaultButton(Button button,
Event evt,
Container deliverTo,
boolean bSetFocus)
- Associates a button and an event with pressing the Enter/Return key.
- Parameters:
- button - the button to set as default
- evt - the event to be delivered in response to pressing the
Enter/Return key
- deliverTo - the container to deliver the event to
- bSetFocus - whether to set focus to the button before
delivering the event
- See Also:
- removeDefaultButton
setCancelButton
public void setCancelButton(Button button)
- Sets the button to press when the Escape key is pressed.
- Parameters:
- button - the button to set as Cancel
- See Also:
- removeCancelButton
setCancelButton
public void setCancelButton(Button button,
Event evt,
Container deliverTo,
boolean bSetFocus)
- Associates a button and an event with pressing the Escape key.
- Parameters:
- button - the button to set as Cancel
- evt - the event to be delivered in response to pressing the Escape
key
- deliverTo - the container to deliver the event to
- bSetFocus - whether to set focus to the button before
delivering the event
- See Also:
- removeCancelButton
removeCancelButton
public void removeCancelButton()
- Removes Escape key association with current Cancel button/event
- See Also:
- setCancelButton
setFKeyEvent
public void setFKeyEvent(int fKey,
Event evt,
Container deliverTo)
- Associates an event with pressing a Function key.
- Parameters:
- fKey - the Event.F1 - Event.F12 constant
- evt - the event to be delivered in response to pressing a Function
key
- deliverTo - the container to deliver the event to
- See Also:
- removeFKeyEvent
removeFKeyEvent
public void removeFKeyEvent(int fKey)
- Removes association of an event with a Function key press
- Parameters:
- fKey - the Event.F1 - Event.F12 constant
- See Also:
- setFKeyEvent
setFKeyEvent
public void setFKeyEvent(int fKey,
int modifier,
Event evt,
Container deliverTo)
- Associates an event with a modified Function key press.
- Parameters:
- fKey - the Event.F1 - Event.F12 constant
- modifier - PLAIN, SHIFT, or CTRL modifier
- evt - the event to be delivered in response to the Function key
press
- deliverTo - the container to deliver the event to
- See Also:
- removeFKeyEvent
removeFKeyEvent
public void removeFKeyEvent(int fKey,
int modifier)
- Removes association of an event with a Function key press
- Parameters:
- fKey - the Event.F1 - Event.F12 constant
- modifier - PLAIN, SHIFT, or CTRL modifier
- See Also:
- setFKeyEvent
All Packages Class Hierarchy This Package Previous Next Index