Commit | Line | Data |
---|---|---|
e3dfbd23 KL |
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.*; | |
e3dfbd23 KL |
34 | |
35 | /** | |
36 | * This window demonstates the TRadioGroup, TRadioButton, and TCheckbox | |
37 | * widgets. | |
38 | */ | |
7668cb45 | 39 | public class DemoCheckboxWindow extends TWindow { |
e3dfbd23 KL |
40 | |
41 | /** | |
42 | * Constructor. | |
43 | * | |
44 | * @param parent the main application | |
45 | */ | |
46 | DemoCheckboxWindow(final TApplication parent) { | |
47 | this(parent, CENTERED | RESIZABLE); | |
48 | } | |
49 | ||
50 | /** | |
51 | * Constructor. | |
52 | * | |
53 | * @param parent the main application | |
54 | * @param flags bitmask of MODAL, CENTERED, or RESIZABLE | |
55 | */ | |
56 | DemoCheckboxWindow(final TApplication parent, final int flags) { | |
57 | // Construct a demo window. X and Y don't matter because it will be | |
58 | // centered on screen. | |
59 | super(parent, "Radiobuttons and Checkboxes", 0, 0, 60, 15, flags); | |
60 | ||
61 | int row = 1; | |
62 | ||
63 | // Add some widgets | |
64 | addLabel("Check box example 1", 1, row); | |
65 | addCheckbox(35, row++, "Checkbox 1", false); | |
66 | addLabel("Check box example 2", 1, row); | |
67 | addCheckbox(35, row++, "Checkbox 2", true); | |
68 | row += 2; | |
69 | ||
70 | TRadioGroup group = addRadioGroup(1, row, "Group 1"); | |
71 | group.addRadioButton("Radio option 1"); | |
72 | group.addRadioButton("Radio option 2"); | |
73 | group.addRadioButton("Radio option 3"); | |
74 | ||
75 | addButton("&Close Window", (getWidth() - 14) / 2, getHeight() - 4, | |
76 | new TAction() { | |
77 | public void DO() { | |
78 | DemoCheckboxWindow.this.getApplication() | |
79 | .closeWindow(DemoCheckboxWindow.this); | |
80 | } | |
81 | } | |
82 | ); | |
83 | } | |
84 | ||
85 | } |