2 * Jexer - Java Text User Interface
4 * License: LGPLv3 or later
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.
10 * Copyright (C) 2015 Kevin Lamonte
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.
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.
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
28 * @author Kevin Lamonte [kevin.lamonte@gmail.com]
36 * This window demonstates the TMessageBox and TInputBox widgets.
38 public class DemoMsgBoxWindow
extends TWindow
{
43 * @param parent the main application
45 DemoMsgBoxWindow(final TApplication parent
) {
46 this(parent
, TWindow
.CENTERED
| TWindow
.RESIZABLE
);
52 * @param parent the main application
53 * @param flags bitmask of MODAL, CENTERED, or RESIZABLE
55 DemoMsgBoxWindow(final TApplication parent
, final int flags
) {
56 // Construct a demo window. X and Y don't matter because it
57 // will be centered on screen.
58 super(parent
, "Message Boxes", 0, 0, 60, 15, flags
);
63 addLabel("Default OK message box", 1, row
);
64 addButton("Open O&K MB", 35, row
,
67 getApplication().messageBox("OK MessageBox",
68 "This is an example of a OK MessageBox. This is the\n" +
69 "default MessageBox.\n" +
71 "Note that the MessageBox text can span multiple\n" +
74 "The default result (if someone hits the top-left\n" +
75 "close button) is OK.\n",
82 addLabel("OK/Cancel message box", 1, row
);
83 addButton("O&pen OKC MB", 35, row
,
86 getApplication().messageBox("OK/Cancel MessageBox",
87 "This is an example of a OK/Cancel MessageBox.\n" +
89 "Note that the MessageBox text can span multiple\n" +
92 "The default result (if someone hits the top-left\n" +
93 "close button) is CANCEL.\n",
94 TMessageBox
.Type
.OKCANCEL
);
100 addLabel("Yes/No message box", 1, row
);
101 addButton("Open &YN MB", 35, row
,
104 getApplication().messageBox("Yes/No MessageBox",
105 "This is an example of a Yes/No MessageBox.\n" +
107 "Note that the MessageBox text can span multiple\n" +
110 "The default result (if someone hits the top-left\n" +
111 "close button) is NO.\n",
112 TMessageBox
.Type
.YESNO
);
118 addLabel("Yes/No/Cancel message box", 1, row
);
119 addButton("Ope&n YNC MB", 35, row
,
122 getApplication().messageBox("Yes/No/Cancel MessageBox",
123 "This is an example of a Yes/No/Cancel MessageBox.\n" +
125 "Note that the MessageBox text can span multiple\n" +
128 "The default result (if someone hits the top-left\n" +
129 "close button) is CANCEL.\n",
130 TMessageBox
.Type
.YESNOCANCEL
);
136 addLabel("Input box", 1, row
);
137 addButton("Open &input box", 35, row
,
140 TInputBox in
= getApplication().inputBox("Input Box",
141 "This is an example of an InputBox.\n" +
143 "Note that the InputBox text can span multiple\n" +
146 getApplication().messageBox("Your InputBox Answer",
147 "You entered: " + in
.getText());
152 addButton("&Close Window", (getWidth() - 14) / 2, getHeight() - 4,
155 getApplication().closeWindow(DemoMsgBoxWindow
.this);