Class KeySequence
- All Implemented Interfaces:
Comparable
A KeySequence is defined as a list of zero or more
KeyStrokes, with the stipulation that all KeyStroke
objects must be complete, save for the last one, whose completeness is
optional. A KeySequence is said to be complete if all of its
KeyStroke objects are complete.
All KeySequence objects have a formal string representation
available via the toString() method. There are a number of
methods to get instances of KeySequence objects, including one
which can parse this formal string representation.
All KeySequence objects, via the format() method,
provide a version of their formal string representation translated by
platform and locale, suitable for display to a user.
KeySequence objects are immutable. Clients are not permitted to
extend this class.
- Since:
- 3.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated, for removal: This API element is subject to removal in a future version.The delimiter between multiple key strokes in a single key sequence -- expressed in the formal key stroke grammar.static final StringDeprecated, for removal: This API element is subject to removal in a future version.The set of delimiters forKeyStrokeobjects allowed during parsing of the formal string representation. -
Method Summary
Modifier and TypeMethodDescriptionintDeprecated, for removal: This API element is subject to removal in a future version.booleanendsWith(KeySequence keySequence, boolean equals) Deprecated, for removal: This API element is subject to removal in a future version.Returns whether or not this key sequence ends with the given key sequence.booleanDeprecated, for removal: This API element is subject to removal in a future version.format()Deprecated, for removal: This API element is subject to removal in a future version.Formats this key sequence into the current default look.static KeySequenceDeprecated, for removal: This API element is subject to removal in a future version.Gets an instance ofKeySequence.static KeySequencegetInstance(String string) Deprecated, for removal: This API element is subject to removal in a future version.Gets an instance ofKeySequenceby parsing a given a formal string representation.static KeySequencegetInstance(List keyStrokes) Deprecated, for removal: This API element is subject to removal in a future version.Gets an instance ofKeySequencegiven a list of key strokes.static KeySequencegetInstance(KeySequence newKeySequence) Deprecated, for removal: This API element is subject to removal in a future version.Gets an instance ofKeySequencegiven a new-style key sequence.static KeySequencegetInstance(KeySequence keySequence, KeyStroke keyStroke) Deprecated, for removal: This API element is subject to removal in a future version.Gets an instance ofKeySequencegiven a key sequence and a key stroke.static KeySequencegetInstance(KeyStroke keyStroke) Deprecated, for removal: This API element is subject to removal in a future version.Gets an instance ofKeySequencegiven a single key stroke.static KeySequencegetInstance(KeyStroke[] keyStrokes) Deprecated, for removal: This API element is subject to removal in a future version.Gets an instance ofKeySequencegiven an array of key strokes.Deprecated, for removal: This API element is subject to removal in a future version.Returns the list of key strokes for this key sequence.inthashCode()Deprecated, for removal: This API element is subject to removal in a future version.booleanDeprecated, for removal: This API element is subject to removal in a future version.Returns whether or not this key sequence is complete.booleanisEmpty()Deprecated, for removal: This API element is subject to removal in a future version.Returns whether or not this key sequence is empty.booleanstartsWith(KeySequence keySequence, boolean equals) Deprecated, for removal: This API element is subject to removal in a future version.Returns whether or not this key sequence starts with the given key sequence.toString()Deprecated, for removal: This API element is subject to removal in a future version.Returns the formal string representation for this key sequence.
-
Field Details
-
KEY_STROKE_DELIMITER
Deprecated, for removal: This API element is subject to removal in a future version.The delimiter between multiple key strokes in a single key sequence -- expressed in the formal key stroke grammar. This is not to be displayed to the user. It is only intended as an internal representation.- See Also:
-
KEY_STROKE_DELIMITERS
Deprecated, for removal: This API element is subject to removal in a future version.The set of delimiters forKeyStrokeobjects allowed during parsing of the formal string representation.- See Also:
-
-
Method Details
-
getInstance
Deprecated, for removal: This API element is subject to removal in a future version.Gets an instance ofKeySequence.- Returns:
- a key sequence. This key sequence will have no key strokes.
Guaranteed not to be
null.
-
getInstance
Deprecated, for removal: This API element is subject to removal in a future version.Gets an instance ofKeySequencegiven a key sequence and a key stroke.- Parameters:
keySequence- a key sequence. Must not benull.keyStroke- a key stroke. Must not benull.- Returns:
- a key sequence that is equal to the given key sequence with the given
key stroke appended to the end. Guaranteed not to be
null.
-
getInstance
Deprecated, for removal: This API element is subject to removal in a future version.Gets an instance ofKeySequencegiven a single key stroke.- Parameters:
keyStroke- a single key stroke. Must not benull.- Returns:
- a key sequence. Guaranteed not to be
null.
-
getInstance
Deprecated, for removal: This API element is subject to removal in a future version.Gets an instance ofKeySequencegiven an array of key strokes.- Parameters:
keyStrokes- the array of key strokes. This array may be empty, but it must not benull. This array must not containnullelements.- Returns:
- a key sequence. Guaranteed not to be
null.
-
getInstance
Deprecated, for removal: This API element is subject to removal in a future version.Gets an instance ofKeySequencegiven a list of key strokes.- Parameters:
keyStrokes- the list of key strokes. This list may be empty, but it must not benull. If this list is not empty, it must only contain instances ofKeyStroke.- Returns:
- a key sequence. Guaranteed not to be
null.
-
getInstance
Deprecated, for removal: This API element is subject to removal in a future version.Gets an instance ofKeySequencegiven a new-style key sequence.- Parameters:
newKeySequence- The new-style key sequence to convert into a legacy key sequence; must not benull.- Returns:
- a key sequence; never
null.
-
getInstance
Deprecated, for removal: This API element is subject to removal in a future version.Gets an instance ofKeySequenceby parsing a given a formal string representation.- Parameters:
string- the formal string representation to parse.- Returns:
- a key sequence. Guaranteed not to be
null. - Throws:
ParseException- if the given formal string representation could not be parsed to a valid key sequence.
-
compareTo
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
compareToin interfaceComparable
-
endsWith
Deprecated, for removal: This API element is subject to removal in a future version.Returns whether or not this key sequence ends with the given key sequence.- Parameters:
keySequence- a key sequence. Must not benull.equals- whether or not an identical key sequence should be considered as a possible match.- Returns:
true, iff the given key sequence ends with this key sequence.
-
equals
Deprecated, for removal: This API element is subject to removal in a future version. -
format
Deprecated, for removal: This API element is subject to removal in a future version.Formats this key sequence into the current default look.- Returns:
- A string representation for this key sequence using the default look;
never
null.
-
getKeyStrokes
Deprecated, for removal: This API element is subject to removal in a future version.Returns the list of key strokes for this key sequence.- Returns:
- the list of key strokes keys. This list may be empty, but is
guaranteed not to be
null. If this list is not empty, it is guaranteed to only contain instances ofKeyStroke.
-
hashCode
public int hashCode()Deprecated, for removal: This API element is subject to removal in a future version. -
isComplete
public boolean isComplete()Deprecated, for removal: This API element is subject to removal in a future version.Returns whether or not this key sequence is complete. Key sequences are complete iff all of their key strokes are complete.- Returns:
true, iff the key sequence is complete.
-
isEmpty
public boolean isEmpty()Deprecated, for removal: This API element is subject to removal in a future version.Returns whether or not this key sequence is empty. Key sequences are complete iff they have no key strokes.- Returns:
true, iff the key sequence is empty.
-
startsWith
Deprecated, for removal: This API element is subject to removal in a future version.Returns whether or not this key sequence starts with the given key sequence.- Parameters:
keySequence- a key sequence. Must not benull.equals- whether or not an identical key sequence should be considered as a possible match.- Returns:
true, iff the given key sequence starts with this key sequence.
-
toString
Deprecated, for removal: This API element is subject to removal in a future version.Returns the formal string representation for this key sequence.
-