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 CONTROL_MASK;
public final static int KEY_DOWN;
public final static int KEY_UP;
public final static int META_MASK;
public final static int SHIFT_MASK;
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
- Mouse "down" event.
KEY_UP
public final static int KEY_UP
- Mouse "up" event.
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.
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