Class KeyEvent
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class KeyEvent

public class netscape.application.KeyEvent
    extends netscape.application.Event
{
    /* Fields
     */
    public final static int ALT_MASK;
    public final static int BACKSPACE_KEY;  *Beta API*
    public final static int CONTROL_MASK;
    public final static int DELETE_KEY;  *Beta API*
    public final static int DOWN_ARROW_KEY;  *Beta API*
    public final static int END_KEY;  *Beta API*
    public final static int ESCAPE_KEY;  *Beta API*
    public final static int F10_KEY;  *Beta API*
    public final static int F11_KEY;  *Beta API*
    public final static int F12_KEY;  *Beta API*
    public final static int F1_KEY;  *Beta API*
    public final static int F2_KEY;  *Beta API*
    public final static int F3_KEY;  *Beta API*
    public final static int F4_KEY;  *Beta API*
    public final static int F5_KEY;  *Beta API*
    public final static int F6_KEY;  *Beta API*
    public final static int F7_KEY;  *Beta API*
    public final static int F8_KEY;  *Beta API*
    public final static int F9_KEY;  *Beta API*
    public final static int HOME_KEY;  *Beta API*
    public final static int KEY_DOWN;
    public final static int KEY_UP;
    public final static int LEFT_ARROW_KEY;  *Beta API*
    public final static int META_MASK;
    public final static int NO_MODIFIERS_MASK;  *Beta API*
    public final static int PAGE_DOWN_KEY;  *Beta API*
    public final static int PAGE_UP_KEY;  *Beta API*
    public final static int RETURN_KEY;
    public final static int RIGHT_ARROW_KEY;  *Beta API*
    public final static int SHIFT_MASK;
    public final static int TAB_KEY;  *Beta API*
    public final static int UP_ARROW_KEY;  *Beta API*

    public int key;
    public int modifiers;

    /* Constructors
     */
    public KeyEvent();
    public KeyEvent(long, int, int, boolean);

    /* Methods
     */
    public boolean isAltKeyDown();
    public boolean isArrowKey();
    public boolean isBackTabKey();
    public boolean isBackspaceKey();
    public boolean isControlKeyDown();
    public boolean isDeleteKey();
    public boolean isDownArrowKey();
    public boolean isEndKey();
    public boolean isEscapeKey();
    public int isFunctionKey();
    public boolean isHomeKey();
    public boolean isLeftArrowKey();
    public boolean isMetaKeyDown();
    public boolean isPageDownKey();
    public boolean isPageUpKey();
    public boolean isPrintableKey();
    public boolean isReturnKey();
    public boolean isRightArrowKey();
    public boolean isShiftKeyDown();
    public boolean isTabKey();
    public boolean isUpArrowKey();
    public RootView rootView();
    public void setRootView(RootView);
    public String toString();
}
Event subclass used for all key up and key down events.

Fields

key

  public int key
The key that was pressed or released.

modifiers

  public int modifiers
The modifier keys that the user held down when the KeyEvent was generated.

KEY_DOWN

  public final static int KEY_DOWN
Key "down" event.

KEY_UP

  public final static int KEY_UP
Key "up" event.

NO_MODIFIERS_MASK

  public final static int NO_MODIFIERS_MASK
No modifiers

ALT_MASK

  public final static int ALT_MASK
The Alternate key modifier bitmask.

CONTROL_MASK

  public final static int CONTROL_MASK
The Control key modifier bitmask.

SHIFT_MASK

  public final static int SHIFT_MASK
The Shift key modifier bitmask.

META_MASK

  public final static int META_MASK
The Meta key modifier bitmask.

RETURN_KEY

  public final static int RETURN_KEY
Return key

BACKSPACE_KEY

  public final static int BACKSPACE_KEY
Backspace key

DELETE_KEY

  public final static int DELETE_KEY
Delete key

ESCAPE_KEY

  public final static int ESCAPE_KEY
Escape key

TAB_KEY

  public final static int TAB_KEY
Tab key

UP_ARROW_KEY

  public final static int UP_ARROW_KEY
Up arrow key

DOWN_ARROW_KEY

  public final static int DOWN_ARROW_KEY
Down arrow key

LEFT_ARROW_KEY

  public final static int LEFT_ARROW_KEY
Left arrow key

RIGHT_ARROW_KEY

  public final static int RIGHT_ARROW_KEY
Right arrow key

HOME_KEY

  public final static int HOME_KEY
Home key

END_KEY

  public final static int END_KEY
End key

PAGE_UP_KEY

  public final static int PAGE_UP_KEY
Page up key

PAGE_DOWN_KEY

  public final static int PAGE_DOWN_KEY
Page down key

F1_KEY

  public final static int F1_KEY
F1 Key

F2_KEY

  public final static int F2_KEY
F2 Key

F3_KEY

  public final static int F3_KEY
F3 Key

F4_KEY

  public final static int F4_KEY
F4 Key

F5_KEY

  public final static int F5_KEY
F5 Key

F6_KEY

  public final static int F6_KEY
F6 Key

F7_KEY

  public final static int F7_KEY
F7 Key

F8_KEY

  public final static int F8_KEY
F8 Key

F9_KEY

  public final static int F9_KEY
F9 Key

F10_KEY

  public final static int F10_KEY
F10 Key

F11_KEY

  public final static int F11_KEY
F11 Key

F12_KEY

  public final static int F12_KEY
F12 Key

Constructors

KeyEvent

  public KeyEvent()
Constructs a KeyEvent.

KeyEvent

  public KeyEvent(long timeStamp,
                  int key,
                  int modifiers,
                  boolean down)
Constructs a KeyEvent to hold key press information for the specified key. modifiers is the bitmask representing the modifier keys held down during the key press. down specifies whether the event represents a key up or key down event.

Methods

isShiftKeyDown

  public boolean isShiftKeyDown()
Returns true if the Shift key was held down during the key event.

isControlKeyDown

  public boolean isControlKeyDown()
Returns true if the Control key was held down during the key event.

isMetaKeyDown

  public boolean isMetaKeyDown()
Returns true if the Meta key was held down during the key event.

isAltKeyDown

  public boolean isAltKeyDown()
Returns true if the Alt key was held down during the key event.

isReturnKey

  public boolean isReturnKey()
Returns true if the KeyEvent represents the Return key.

isBackspaceKey

  public boolean isBackspaceKey()
Returns true if the KeyEvent represents the Backspace key.

isDeleteKey

  public boolean isDeleteKey()
Returns true if the KeyEvent represents the Delete key. In general, the key used to delete characters is the "Backspace" key in the upper-right corner of the keyboard (the Mac calls it "Delete").
See Also:
isBackspaceKey

isEscapeKey

  public boolean isEscapeKey()
Returns true if the KeyEvent represents the Escape key.

isTabKey

  public boolean isTabKey()
Returns true if the KeyEvent represents the Tab key.

isBackTabKey

  public boolean isBackTabKey()
Returns true if the KeyEvent represents the BackTab (Shift + Tab) key.

isUpArrowKey

  public boolean isUpArrowKey()
Returns true if the KeyEvent represents the Up Arrow key.

isDownArrowKey

  public boolean isDownArrowKey()
Returns true if the KeyEvent represents the Down Arrow key.

isLeftArrowKey

  public boolean isLeftArrowKey()
Returns true if the KeyEvent represents the Left Arrow key.

isRightArrowKey

  public boolean isRightArrowKey()
Returns true if the KeyEvent represents the Right Arrow key.

isArrowKey

  public boolean isArrowKey()
Returns true if the KeyEvent represents the Arrow key.

isHomeKey

  public boolean isHomeKey()
Returns true if the KeyEvent represents the Home key.

isEndKey

  public boolean isEndKey()
Returns true if the KeyEvent represents the End key.

isPageUpKey

  public boolean isPageUpKey()
Returns true if the KeyEvent represents the Page Up key.

isPageDownKey

  public boolean isPageDownKey()
Returns true if the KeyEvent represents the Page Down key.

isFunctionKey

  public int isFunctionKey()
Returns the function key number or 0 if the KeyEvent does not represent a function key.

isPrintableKey

  public boolean isPrintableKey()
Returns true if the KeyEvent represents a printable ASCII character.

setRootView

  public void setRootView(RootView rootView)
Sets the RootView associated with the KeyEvent.

rootView

  public RootView rootView()
Returns the RootView associated with the KeyEvent.
See Also:
setRootView

toString

  public String toString()
Returns the KeyEvent's String representation.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index

Copyright © 1997 Netscape Communications Corporation. All rights reserved
Please send any comments or corrections to ifcfeedback@netscape.com
HTML generated on 21 Apr 1997