@Override
    public void keyTyped(KeyEvent ke) {
        char c = ke.getKeyChar();
        if (c == '\n' || c == '\r') {
            lastKey = "enter";
        } else if (c == '\t') {
            lastKey = "tab";
        } else if (c == '\b') {
            lastKey = "backspace";
        } else if (c == ' ') {
            lastKey = "space";
        } else if (c == 27) {
            lastKey = "escape";
        } else {
            lastKey = "" + c;
        }
    }