com.sun.electric.tool.user.ui
Class KeyStrokePair

java.lang.Object
  extended by com.sun.electric.tool.user.ui.KeyStrokePair

public class KeyStrokePair
extends java.lang.Object

User: gainsley Date: Apr 6, 2004 Time: 12:31:27 PM


Method Summary
static KeyStrokePair getKeyStrokePair(javax.swing.KeyStroke prefixStroke, javax.swing.KeyStroke stroke)
          Factory method to get a new KeyStrokePair.
static KeyStrokePair getKeyStrokePair(java.lang.String keyString)
          Get a KeyStrokePair from a String representation.
 javax.swing.KeyStroke getPrefixStroke()
           
static java.lang.String getStringFromKeyStroke(javax.swing.KeyStroke key)
           
 javax.swing.KeyStroke getStroke()
           
 int hashCode()
          Returns a numeric value for this object that is likely to be unique.
static java.lang.String keyStrokeToString(javax.swing.KeyStroke key)
          Converts KeyStroke to String that can be parsed by KeyStroke.getKeyStroke(String s).
static javax.swing.KeyStroke stringToKeyStroke(java.lang.String str)
           
 java.lang.String toString()
          Convert this KeyStrokePair to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getKeyStrokePair

public static KeyStrokePair getKeyStrokePair(javax.swing.KeyStroke prefixStroke,
                                             javax.swing.KeyStroke stroke)
Factory method to get a new KeyStrokePair. KeyStrokePairs are unique, therefore two objects of the same pair of key strokes will be the same object. Which means == is the same as .equals().

Parameters:
prefixStroke - the prefix stroke
stroke - the primary stroke
Returns:
a new KeyStrokePair

getKeyStrokePair

public static KeyStrokePair getKeyStrokePair(java.lang.String keyString)
Get a KeyStrokePair from a String representation. The string consists of two KeyStroke strings separated by a separator (currently ", "). The KeyStroke strings are generated by keyStrokeToString.

Parameters:
keyString - the string to be converted to a key stroke pair
Returns:
a KeyStrokePair. May return null if invalid keyString

toString

public java.lang.String toString()
Convert this KeyStrokePair to a string.

Overrides:
toString in class java.lang.Object
Returns:
a string representing this KeyStrokePair.

getStringFromKeyStroke

public static java.lang.String getStringFromKeyStroke(javax.swing.KeyStroke key)

keyStrokeToString

public static java.lang.String keyStrokeToString(javax.swing.KeyStroke key)
Converts KeyStroke to String that can be parsed by KeyStroke.getKeyStroke(String s). For some reason the KeyStroke class has a method to parse a KeyStroke String identifier, but not one to make one.


stringToKeyStroke

public static javax.swing.KeyStroke stringToKeyStroke(java.lang.String str)

getPrefixStroke

public javax.swing.KeyStroke getPrefixStroke()

getStroke

public javax.swing.KeyStroke getStroke()

hashCode

public int hashCode()
Returns a numeric value for this object that is likely to be unique. Uses hash codes of prefixStroke and stroke (which are derived from fields of those KeyStrokes. see KeyStroke.hashCode().

Overrides:
hashCode in class java.lang.Object
Returns:
an int that represents this object