Пример #1
0
 /** Performs a set of sanity checks to make sure the keystroke is valid. */
 private void performSanityChecks(String keystroke, List<String> components) {
   if (components.size() > 1
       && keystroke.endsWith("-")
       && !"-".equals(CollectionUtility.lastElement(components))) {
     m_isValid = false;
   }
 }
Пример #2
0
 /**
  * Parses the key of the list of components. The key is the last element of the components but
  * can't be a modifier.
  */
 private void parseKey(List<String> components) {
   String key = CollectionUtility.lastElement(components);
   if (isModifier(key)) {
     m_isValid = false;
   } else {
     m_key = key;
     m_normalizedKeyStroke =
         (m_shift ? "shift-" : "")
             + (m_ctrl ? "control-" : "")
             + (m_alt ? "alternate-" : "")
             + m_key;
   }
 }