thinwire.ui.event
Class KeyPressEvent

java.lang.Object
  extended by java.util.EventObject
      extended by thinwire.ui.event.KeyPressEvent
All Implemented Interfaces:
java.io.Serializable

public class KeyPressEvent
extends java.util.EventObject

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
KeyPressEvent(java.lang.String keyPressCombo, Component source)
           
 
Method Summary
static java.lang.String encodeKeyPressCombo(boolean ctrl, boolean alt, boolean shift, java.lang.String key)
          Combines the individual elements of a key press combination into a normalized string.
 boolean equals(java.lang.Object o)
           
 java.lang.String getKey()
           
 java.lang.String getKeyPressCombo()
           
 Component getSourceComponent()
           
 int hashCode()
           
 boolean isAlt()
           
 boolean isCtrl()
           
 boolean isShift()
           
static java.lang.String normalizeKeyPressCombo(java.lang.String keyPressCombo)
          Parses the specified keyPressCombo and return's it in a normalized form.
 java.lang.String toString()
           
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyPressEvent

public KeyPressEvent(java.lang.String keyPressCombo,
                     Component source)
Method Detail

encodeKeyPressCombo

public static java.lang.String encodeKeyPressCombo(boolean ctrl,
                                                   boolean alt,
                                                   boolean shift,
                                                   java.lang.String key)
Combines the individual elements of a key press combination into a normalized string. The first part of the returned string contains the following key modifier string: The last part of the string is a result of the value specified by the key argument. However, it is normalized into one of the following values:

"Dash", "=", "`", "[", "]", "\\", ";", "'", ",", ".", "/", "PageUp", "PageDown", "End", "Home", "ArrowLeft", "ArrowRight", "ArrowDown", "ArrowUp", "Space", "Enter", "Esc", "Tab", "BackSpace", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "Del", "Ins", "Pause", "ScrollLock", "NumLock", "Num0", "Num1", "Num2", "Num3", "Num4", "Num5", "Num6", "Num7", "Num8", "Num9", "Num*", "Num+", "NumDash", "Num/", "Num."

Parameters:
ctrl - if true, the returned string will contain "Ctrl-" per the rules above.
alt - if true, the returned string will contain "Alt-" per the rules above.
shift - if true, the returned string will contain "Shift-" per the rules above.
key - returned as part of the string, only in a normalized form per the rules above.
Returns:
a key press combo string representing the elements specified per the rules above.

normalizeKeyPressCombo

public static java.lang.String normalizeKeyPressCombo(java.lang.String keyPressCombo)
Parses the specified keyPressCombo and return's it in a normalized form. This method will accept a string that is of any case and that has it's key modifier(s) in any order. The sole restriction is that the elements of the key press combination must be separated by a dash '-'. The purpose of this method is to provide a way of generating a properly formed key press combination strings (i.e. normalized). The normalized string form returned by this method is defined by the encodeKeyPressCombo method above.

Parameters:
keyPressCombo - a key press combo in any dash separated format.
Returns:
a normalized form of keyPressCombo, per the defintion in the encodeKeyPressCombo method.
See Also:
encodeKeyPressCombo(boolean, boolean, boolean, String)

getSourceComponent

public Component getSourceComponent()

isCtrl

public boolean isCtrl()

isAlt

public boolean isAlt()

isShift

public boolean isShift()

getKey

public java.lang.String getKey()

getKeyPressCombo

public java.lang.String getKeyPressCombo()

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.util.EventObject


ThinWire® is a registered of Custom Credit Systems  Copyright © 2007 All rights reserved.
ThinWire_is_Open_Source_under_the_terms_of_the_LGPLv2.1 SourceForge.net_Project_Page java.net_Member Support_ThinWire,_Digg_our_Story