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:


Variable Index

 o CTRL
A constant that indicates CTRL was pressed with a key.
 o PLAIN
A constant that indicates no modifier keys (SHIFT,CTRL) were pressed with a key.
 o SHIFT
A constant that indicates SHIFT was pressed with a key.

Constructor Index

 o KeyPressManagerPanel()
Constructs a Panel which handles key press events.

Method Index

 o add(Component)
Adds a component to the end of this container.
 o getAutoTabState()
Gets the current automatic tab state.
 o getTabToTextComponetsOnly()
Gets whether tabbing is to TextComponents only.
 o handleEvent(Event)
Processes events for this component.
 o removeCancelButton()
Removes Escape key association with current Cancel button/event
 o removeDefaultButton()
Removes Enter/Return key association with current default button/event.
 o removeFKeyEvent(int)
Removes association of an event with a Function key press
 o removeFKeyEvent(int, int)
Removes association of an event with a Function key press
 o resetKeyManager()
Resets all KeyPressManager associations (default button, cancel button, tab stop list).
 o setAutoTabState(boolean)
Sets the automatic tab state.
 o setCancelButton(Button)
Sets the button to press when the Escape key is pressed.
 o setCancelButton(Button, Event, Container, boolean)
Associates a button and an event with pressing the Escape key.
 o setDefaultButton(Button)
Sets the button to press when the Enter or Return key is pressed.
 o setDefaultButton(Button, Event, Container, boolean)
Associates a button and an event with pressing the Enter/Return key.
 o setFKeyEvent(int, Event, Container)
Associates an event with pressing a Function key.
 o setFKeyEvent(int, int, Event, Container)
Associates an event with a modified Function key press.
 o setTabStop(Component)
Allows tabbing to the specified component.
 o setTabToTextComponetsOnly(boolean)
Sets whether tabs should only change focus to TextComponents.

Variables

 o PLAIN
  public final static int PLAIN
A constant that indicates no modifier keys (SHIFT,CTRL) were pressed with a key.

 o SHIFT
  public final static int SHIFT
A constant that indicates SHIFT was pressed with a key.

 o CTRL
  public final static int CTRL
A constant that indicates CTRL was pressed with a key.

Constructors

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

Methods

 o 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
 o 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
 o 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
 o 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
 o 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
 o resetKeyManager
  public void resetKeyManager()
Resets all KeyPressManager associations (default button, cancel button, tab stop list).

 o 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
 o removeDefaultButton
  public void removeDefaultButton()
Removes Enter/Return key association with current default button/event.

See Also:
setDefaultButton
 o 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
 o 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
 o 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
 o 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
 o 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
 o removeCancelButton
  public void removeCancelButton()
Removes Escape key association with current Cancel button/event

See Also:
setCancelButton
 o 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
 o 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
 o 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
 o 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