Commit | Line | Data |
---|---|---|
df8de03f KL |
1 | /** |
2 | * Jexer - Java Text User Interface | |
3 | * | |
df8de03f KL |
4 | * License: LGPLv3 or later |
5 | * | |
7b5261bc KL |
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. | |
df8de03f KL |
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 | |
7b5261bc KL |
27 | * |
28 | * @author Kevin Lamonte [kevin.lamonte@gmail.com] | |
29 | * @version 1 | |
df8de03f KL |
30 | */ |
31 | package jexer.event; | |
32 | ||
33 | /** | |
34 | * This class encapsulates a menu selection event. | |
35 | * TApplication.getMenuItem(id) can be used to obtain the TMenuItem itself, | |
36 | * say for setting enabled/disabled/checked/etc. | |
37 | */ | |
d4a29741 | 38 | public final class TMenuEvent extends TInputEvent { |
df8de03f KL |
39 | |
40 | /** | |
7b5261bc KL |
41 | * MenuItem ID. |
42 | */ | |
928811d8 | 43 | private int id; |
7b5261bc KL |
44 | |
45 | /** | |
46 | * Get the MenuItem ID. | |
47 | * | |
48 | * @return the ID | |
df8de03f | 49 | */ |
928811d8 | 50 | public int getId() { |
7b5261bc KL |
51 | return id; |
52 | } | |
df8de03f KL |
53 | |
54 | /** | |
7b5261bc | 55 | * Public contructor. |
df8de03f KL |
56 | * |
57 | * @param id the MenuItem ID | |
58 | */ | |
928811d8 | 59 | public TMenuEvent(final int id) { |
7b5261bc | 60 | this.id = id; |
df8de03f KL |
61 | } |
62 | ||
63 | /** | |
7b5261bc KL |
64 | * Make human-readable description of this TMenuEvent. |
65 | * | |
66 | * @return displayable String | |
df8de03f KL |
67 | */ |
68 | @Override | |
d4a29741 | 69 | public String toString() { |
7b5261bc | 70 | return String.format("MenuEvent: %d", id); |
df8de03f KL |
71 | } |
72 | } |