2 * Jexer - Java Text User Interface
4 * The MIT License (MIT)
6 * Copyright (C) 2019 Kevin Lamonte
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 * DEALINGS IN THE SOFTWARE.
26 * @author Kevin Lamonte [kevin.lamonte@gmail.com]
31 import java
.util
.ResourceBundle
;
33 import jexer
.TApplication
;
37 import jexer
.layout
.BoxLayoutManager
;
40 * This class shows off BoxLayout and TPanel.
47 private static final ResourceBundle i18n
= ResourceBundle
.getBundle(Demo7
.class.getName());
49 // ------------------------------------------------------------------------
50 // Demo7 ------------------------------------------------------------------
51 // ------------------------------------------------------------------------
56 * @param args Command line arguments
58 public static void main(final String
[] args
) throws Exception
{
59 // This demo will build everything "from the outside".
61 // Swing is the default backend on Windows unless explicitly
62 // overridden by jexer.Swing.
63 TApplication
.BackendType backendType
= TApplication
.BackendType
.XTERM
;
64 if (System
.getProperty("os.name").startsWith("Windows")) {
65 backendType
= TApplication
.BackendType
.SWING
;
67 if (System
.getProperty("os.name").startsWith("Mac")) {
68 backendType
= TApplication
.BackendType
.SWING
;
70 if (System
.getProperty("jexer.Swing") != null) {
71 if (System
.getProperty("jexer.Swing", "false").equals("true")) {
72 backendType
= TApplication
.BackendType
.SWING
;
74 backendType
= TApplication
.BackendType
.XTERM
;
77 TApplication app
= new TApplication(backendType
);
80 TWindow window
= new TWindow(app
, i18n
.getString("windowTitle"),
82 window
.setLayoutManager(new BoxLayoutManager(window
.getWidth() - 2,
83 window
.getHeight() - 2, false));
85 TPanel right
= window
.addPanel(0, 0, 10, 10);
86 TPanel left
= window
.addPanel(0, 0, 10, 10);
87 right
.setLayoutManager(new BoxLayoutManager(right
.getWidth(),
88 right
.getHeight(), true));
89 left
.setLayoutManager(new BoxLayoutManager(left
.getWidth(),
90 left
.getHeight(), true));
92 left
.addText("C1", 0, 0, left
.getWidth(), left
.getHeight());
93 left
.addText("C2", 0, 0, left
.getWidth(), left
.getHeight());
94 left
.addText("C3", 0, 0, left
.getWidth(), left
.getHeight());
95 right
.addText("C4", 0, 0, right
.getWidth(), right
.getHeight());
96 right
.addText("C5", 0, 0, right
.getWidth(), right
.getHeight());
97 right
.addText("C6", 0, 0, right
.getWidth(), right
.getHeight());