Java Code Examples for java.awt.event.KeyEvent#VK_DEAD_CIRCUMFLEX

The following examples show how to use java.awt.event.KeyEvent#VK_DEAD_CIRCUMFLEX . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultKeyboardHandler.java    From tn5250j with GNU General Public License v2.0 4 votes vote down vote up
protected void displayInfo(KeyEvent e, String s) {
  String charString, keyCodeString, modString, tmpString, isString;

  char c = e.getKeyChar();
  int keyCode = e.getKeyCode();
  int modifiers = e.getModifiers();

  if (Character.isISOControl(c)) {
    charString = "key character = "
        + "(an unprintable control character)";
  } else {
    charString = "key character = '"
        + c + "'";
  }

  keyCodeString = "key code = " + keyCode
      + " ("
      + KeyEvent.getKeyText(keyCode)
      + ")";
  if (keyCode == KeyEvent.VK_PREVIOUS_CANDIDATE) {

    keyCodeString += " previous candidate ";

  }

  if (keyCode == KeyEvent.VK_DEAD_ABOVEDOT ||
      keyCode == KeyEvent.VK_DEAD_ABOVERING ||
      keyCode == KeyEvent.VK_DEAD_ACUTE ||
      keyCode == KeyEvent.VK_DEAD_BREVE ||
      keyCode == KeyEvent.VK_DEAD_CIRCUMFLEX

      ) {

    keyCodeString += " dead key ";

  }

  modString = "modifiers = " + modifiers;
  tmpString = KeyEvent.getKeyModifiersText(modifiers);
  if (tmpString.length() > 0) {
    modString += " (" + tmpString + ")";
  } else {
    modString += " (no modifiers)";
  }

  isString = "isKeys = isActionKey (" + e.isActionKey() + ")" +
      " isAltDown (" + e.isAltDown() + ")" +
      " isAltGraphDown (" + e.isAltGraphDown() + ")" +
      " isAltGraphDownLinux (" + isAltGr + ")" +
      " isControlDown (" + e.isControlDown() + ")" +
      " isMetaDown (" + e.isMetaDown() + ")" +
      " isShiftDown (" + e.isShiftDown() + ")";


  String newline = "\n";
  System.out.println(s + newline
      + "    " + charString + newline
      + "    " + keyCodeString + newline
      + "    " + modString + newline
      + "    " + isString + newline);

}