| 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.demos; |
| 32 | |
| 33 | import jexer.*; |
| 34 | import jexer.event.*; |
| 35 | import jexer.menu.*; |
| 36 | |
| 37 | /** |
| 38 | * The demo application itself. |
| 39 | */ |
| 40 | class DemoApplication extends TApplication { |
| 41 | |
| 42 | /** |
| 43 | * Public constructor. |
| 44 | * |
| 45 | * @param backendType one of the TApplication.BackendType values |
| 46 | * @throws Exception if TApplication can't instantiate the Backend. |
| 47 | */ |
| 48 | public DemoApplication(BackendType backendType) throws Exception { |
| 49 | super(backendType); |
| 50 | new DemoMainWindow(this); |
| 51 | |
| 52 | // Add the menus |
| 53 | addFileMenu(); |
| 54 | addEditMenu(); |
| 55 | |
| 56 | TMenu demoMenu = addMenu("&Demo"); |
| 57 | TMenuItem item = demoMenu.addItem(2000, "&Checkable"); |
| 58 | item.setCheckable(true); |
| 59 | item = demoMenu.addItem(2001, "Disabled"); |
| 60 | item.setEnabled(false); |
| 61 | item = demoMenu.addItem(2002, "&Normal"); |
| 62 | TSubMenu subMenu = demoMenu.addSubMenu("Sub-&Menu"); |
| 63 | item = demoMenu.addItem(2010, "N&ormal A&&D"); |
| 64 | |
| 65 | item = subMenu.addItem(2000, "&Checkable (sub)"); |
| 66 | item.setCheckable(true); |
| 67 | item = subMenu.addItem(2001, "Disabled (sub)"); |
| 68 | item.setEnabled(false); |
| 69 | item = subMenu.addItem(2002, "&Normal (sub)"); |
| 70 | |
| 71 | subMenu = subMenu.addSubMenu("Sub-&Menu"); |
| 72 | item = subMenu.addItem(2000, "&Checkable (sub)"); |
| 73 | item.setCheckable(true); |
| 74 | item = subMenu.addItem(2001, "Disabled (sub)"); |
| 75 | item.setEnabled(false); |
| 76 | item = subMenu.addItem(2002, "&Normal (sub)"); |
| 77 | |
| 78 | addWindowMenu(); |
| 79 | |
| 80 | } |
| 81 | } |