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
;
35 import jexer
.TSplitPane
;
36 import jexer
.TTerminalWidget
;
39 import jexer
.layout
.BoxLayoutManager
;
40 import jexer
.menu
.TMenu
;
43 * This class shows off TSplitPane.
50 private static final ResourceBundle i18n
= ResourceBundle
.getBundle(Demo8
.class.getName());
52 // ------------------------------------------------------------------------
53 // Constants --------------------------------------------------------------
54 // ------------------------------------------------------------------------
56 private static String TEXT
=
57 "This is an example of a reflowable text field. Some example text follows.\n" +
59 "Notice that some menu items should be disabled when this window has focus.\n" +
61 "This library implements a text-based windowing system loosely " +
62 "reminiscent of Borland's [Turbo " +
63 "Vision](http://en.wikipedia.org/wiki/Turbo_Vision) library. For those " +
64 "wishing to use the actual C++ Turbo Vision library, see [Sergio " +
65 "Sigala's updated version](http://tvision.sourceforge.net/) that runs " +
66 "on many more platforms.\n" +
68 "This library is licensed MIT. See the file LICENSE for the full license " +
71 // ------------------------------------------------------------------------
72 // Demo8 ------------------------------------------------------------------
73 // ------------------------------------------------------------------------
78 * @param args Command line arguments
80 public static void main(final String
[] args
) throws Exception
{
81 // This demo will build everything "from the outside".
83 // Swing is the default backend on Windows unless explicitly
84 // overridden by jexer.Swing.
85 TApplication
.BackendType backendType
= TApplication
.BackendType
.XTERM
;
86 if (System
.getProperty("os.name").startsWith("Windows")) {
87 backendType
= TApplication
.BackendType
.SWING
;
89 if (System
.getProperty("os.name").startsWith("Mac")) {
90 backendType
= TApplication
.BackendType
.SWING
;
92 if (System
.getProperty("jexer.Swing") != null) {
93 if (System
.getProperty("jexer.Swing", "false").equals("true")) {
94 backendType
= TApplication
.BackendType
.SWING
;
96 backendType
= TApplication
.BackendType
.XTERM
;
100 // For this demo, let's disable the status bar.
101 System
.setProperty("jexer.hideStatusBar", "true");
103 TApplication app
= new TApplication(backendType
);
106 TWindow window
= new TWindow(app
, i18n
.getString("windowTitle"),
109 TMenu paneMenu
= app
.addMenu(i18n
.getString("paneMenu"));
110 paneMenu
.addDefaultItem(TMenu
.MID_SPLIT_VERTICAL
, true);
111 paneMenu
.addDefaultItem(TMenu
.MID_SPLIT_HORIZONTAL
, true);
113 TSplitPane pane
= window
.addSplitPane(0, 0, window
.getWidth() - 2,
114 window
.getHeight() - 2, true);
116 // pane.setLeft(new TText(null, TEXT, 0, 0, 10, 10));
117 // pane.setRight(new TText(null, TEXT, 0, 0, 10, 10));
119 // For this demo, let's require ptypipe
120 System
.setProperty("jexer.TTerminal.ptypipe", "true");
121 pane
.setLeft(new TTerminalWidget(null, 0, 0));
122 pane
.setRight(new TTerminalWidget(null, 0, 0));