31bc4aea04c02b5cb8cb52b8b993eba54e18ae60
[fanfix.git] / src / jexer / event / TKeypressEvent.java
1 /**
2 * Jexer - Java Text User Interface
3 *
4 * License: LGPLv3 or later
5 *
6 * This module is licensed under the GNU Lesser General Public License
7 * Version 3. Please see the file "COPYING" in this directory for more
8 * information about the GNU Lesser General Public License Version 3.
9 *
10 * Copyright (C) 2015 Kevin Lamonte
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 3 of
15 * the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this program; if not, see
24 * http://www.gnu.org/licenses/, or write to the Free Software
25 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26 * 02110-1301 USA
27 *
28 * @author Kevin Lamonte [kevin.lamonte@gmail.com]
29 * @version 1
30 */
31 package jexer.event;
32
33 import jexer.TKeypress;
34
35 /**
36 * This class encapsulates a keyboard input event.
37 */
38 public class TKeypressEvent extends TInputEvent {
39
40 /**
41 * Keystroke received.
42 */
43 public TKeypress key;
44
45 /**
46 * Public contructor sets the key to the special kbNoKey.
47 */
48 public TKeypressEvent() {
49 key = TKeypress.kbNoKey;
50 }
51
52 /**
53 * Public contructor.
54 *
55 * @param key the TKeypress received
56 */
57 public TKeypressEvent(final TKeypress key) {
58 this.key = key;
59 }
60
61 /**
62 * Make human-readable description of this TKeypressEvent.
63 *
64 * @return displayable String
65 */
66 @Override
67 public final String toString() {
68 return String.format("Keypress: %s", key.toString());
69 }
70 }