public static String keyStrokeToText(KeyStroke keyStroke){
  String mod=KeyEvent.getKeyModifiersText(keyStroke.getModifiers());
  String key=KeyEvent.getKeyText(keyStroke.getKeyCode());
  if (mod.isEmpty()) {
    return key;
  }
  return mod + "+" + key;
}

public static String keyStrokeToText ( KeyStroke keyStroke ) { String mod = KeyEvent . getKeyModifiersText ( keyStroke . getModifiers ( ) ) ; String key = KeyEvent . getKeyText ( keyStroke . getKeyCode ( ) ) ; if ( mod . isEmpty ( ) ) { return key ; } return mod + "+" + key ; }
turns a keystroke into a readable string .
