Commit | Line | Data |
---|---|---|
7d4115a5 KL |
1 | Jexer - Java Text User Interface library |
2 | ======================================== | |
3 | ||
a4406f4e KL |
4 | WARNING: THIS IS ALPHA CODE! PLEASE CONSIDER FILING BUGS AS YOU |
5 | ENCOUNTER THEM. | |
30bd4abd KL |
6 | |
7 | This library is intended to implement a text-based windowing system | |
8 | loosely reminiscient of Borland's [Turbo | |
9 | Vision](http://en.wikipedia.org/wiki/Turbo_Vision) library. For those | |
10 | wishing to use the actual C++ Turbo Vision library, see [Sergio | |
11 | Sigala's updated version](http://tvision.sourceforge.net/) that runs | |
12 | on many more platforms. | |
7d4115a5 | 13 | |
1ac2ccb1 KL |
14 | Two backends are available: |
15 | ||
30bd4abd KL |
16 | * System.in/out to a command-line ECMA-48 / ANSI X3.64 type terminal |
17 | (tested on Linux + xterm). I/O is handled through terminal escape | |
18 | sequences generated by the library itself: ncurses is not required | |
b5f2a6db KL |
19 | or linked to. xterm mouse tracking using UTF8 and SGR coordinates |
20 | are supported. For the demo application, this is the default | |
21 | backend on non-Windows platforms. | |
1ac2ccb1 | 22 | |
a4406f4e KL |
23 | * Java Swing UI. This backend can be selected by setting |
24 | jexer.Swing=true. The default window size for Swing is 132x40, | |
25 | which is set in jexer.session.SwingSession. For the demo | |
26 | application, this is the default backend on Windows platforms. | |
1ac2ccb1 | 27 | |
a4406f4e KL |
28 | The demo application showing the existing UI controls is available via |
29 | 'java -jar jexer.jar' or 'java -Djexer.Swing=true -jar jexer.jar' . | |
30 | ||
31 | Additional backends can be created by subclassing | |
32 | jexer.backend.Backend and passing it into the TApplication | |
33 | constructor. | |
1ac2ccb1 KL |
34 | |
35 | ||
7d4115a5 KL |
36 | |
37 | License | |
38 | ------- | |
39 | ||
5e9795db KL |
40 | This project is licensed LGPL ("GNU Lesser General Public License", |
41 | sometimes called the "Library GPL") version 3 or greater. You may | |
42 | freely use Jexer in both closed source (proprietary) and open source | |
43 | applications, however any changes you make to the Jexer code must be | |
44 | made available to your users. | |
45 | ||
46 | See the file LICENSE for the full license text, which includes both | |
47 | the GPL v3 and the LGPL supplemental terms. | |
7d4115a5 KL |
48 | |
49 | ||
30bd4abd KL |
50 | |
51 | Acknowledgements | |
52 | ---------------- | |
53 | ||
54 | Jexer makes use of the Terminus TrueType font [made available | |
55 | here](http://files.ax86.net/terminus-ttf/) . | |
56 | ||
57 | ||
58 | ||
7d4115a5 KL |
59 | Usage |
60 | ----- | |
61 | ||
30bd4abd | 62 | Usage patterns are still being worked on, but in general the goal will |
a4406f4e | 63 | be to build applications as follows: |
7d4115a5 KL |
64 | |
65 | ```Java | |
66 | import jexer.*; | |
67 | ||
68 | public class MyApplication extends TApplication { | |
69 | ||
70 | public MyApplication() { | |
a4406f4e | 71 | super(BackendType.SWING); // Could also use BackendType.XTERM |
7d4115a5 | 72 | |
fca67db0 KL |
73 | // Create standard menus for File and Window |
74 | addFileMenu(); | |
75 | addWindowMenu(); | |
7d4115a5 KL |
76 | } |
77 | ||
78 | public static void main(String [] args) { | |
fca67db0 | 79 | MyApplication app = new MyApplication(); |
a4406f4e | 80 | (new Thread(app)).start(); |
7d4115a5 KL |
81 | } |
82 | } | |
83 | ``` | |
84 | ||
87a17f3c | 85 | See the file demos/Demo1.java for detailed examples. |
30bd4abd KL |
86 | |
87 | ||
7d4115a5 | 88 | |
92554d64 KL |
89 | Known Issues / Arbitrary Decisions |
90 | ---------------------------------- | |
91 | ||
92 | Some arbitrary design decisions had to be made when either the | |
93 | obviously expected behavior did not happen or when a specification was | |
94 | ambiguous. This section describes such issues. | |
95 | ||
bb35d919 | 96 | - TTerminalWindow will hang on input from the remote if the |
69345248 KL |
97 | TApplication is exited before the TTerminalWindow's process has |
98 | closed on its own. This is due to a Java limitation/interaction | |
99 | between blocking reads (which is necessary to get UTF8 translation | |
100 | correct) and file streams. | |
92554d64 | 101 | |
bd8d51fa KL |
102 | - See jexer.tterminal.ECMA48 for more specifics of terminal |
103 | emulation limitations. | |
104 | ||
a4406f4e KL |
105 | - TTerminalWindow uses cmd.exe on Windows. Output will not be seen |
106 | until enter is pressed, due to cmd.exe's use of line-oriented | |
107 | input (see the ENABLE_LINE_INPUT flag for GetConsoleMode() and | |
108 | SetConsoleMode()). | |
92554d64 | 109 | |
b5f2a6db KL |
110 | - TTerminalWindow launches 'script -fqe /dev/null' on non-Windows |
111 | platforms. This is a workaround for the C library behavior of | |
112 | checking for a tty: script launches $SHELL in a pseudo-tty. This | |
113 | works on Linux but might not on other Posix-y platforms. | |
114 | ||
e3dfbd23 KL |
115 | - Java's InputStreamReader as used by the ECMA48 backend requires a |
116 | valid UTF-8 stream. The default X10 encoding for mouse | |
117 | coordinates outside (160,94) can corrupt that stream, at best | |
118 | putting garbage keyboard events in the input queue but at worst | |
119 | causing the backend reader thread to throw an Exception and exit | |
120 | and make the entire UI unusable. Mouse support therefore requires | |
121 | a terminal that can deliver either UTF-8 coordinates (1005 mode) | |
122 | or SGR coordinates (1006 mode). Most modern terminals can do | |
123 | this. | |
b5f2a6db KL |
124 | |
125 | - jexer.session.TTYSession calls 'stty size' once every second to | |
126 | check the current window size, performing the same function as | |
127 | ioctl(TIOCGWINSZ) but without requiring a native library. | |
128 | ||
129 | - jexer.io.ECMA48Terminal calls 'stty' to perform the equivalent of | |
130 | cfmakeraw(). The terminal is (blindly!) put back in 'stty sane | |
131 | cooked' mode when exiting. | |
132 | ||
133 | ||
134 | System Properties | |
135 | ----------------- | |
136 | ||
137 | The following properties control features of Jexer: | |
138 | ||
139 | jexer.Swing | |
140 | ----------- | |
141 | ||
142 | Used only by jexer.demos.Demo1. If true, use the Swing interface | |
143 | for the demo application. Default: true on Windows platforms | |
144 | (os.name starts with "Windows"), false on non-Windows platforms. | |
145 | ||
146 | jexer.Swing.cursorStyle | |
147 | ----------------------- | |
148 | ||
149 | Used by jexer.io.SwingScreen. Selects the cursor style to draw. | |
150 | Valid values are: underline, block, outline. Default: underline. | |
8caf0d51 | 151 | |
36338168 KL |
152 | |
153 | ||
7d4115a5 KL |
154 | Roadmap |
155 | ------- | |
156 | ||
30d336cc | 157 | Many tasks remain before calling this version 1.0: |
7d4115a5 | 158 | |
a4406f4e | 159 | 0.0.2: STABILIZE EXISTING |
7d4115a5 | 160 | |
1ac2ccb1 | 161 | - ECMA48Backend running on socket |
a4406f4e KL |
162 | |
163 | 0.0.3: FINISH PORTING | |
7d4115a5 | 164 | |
a4406f4e KL |
165 | - TTreeView |
166 | - Also add keyboard navigation | |
167 | - TDirectoryList | |
168 | - Also add keyboard navigation | |
b5f2a6db | 169 | - TFileOpen |
a4406f4e KL |
170 | |
171 | 0.0.4: NEW STUFF | |
7d4115a5 | 172 | |
a4406f4e | 173 | - Making TMenu keyboard accelerators active/inactive |
cf9af8df | 174 | - TStatusBar |
cc99cba8 | 175 | - TEditor |
a4406f4e KL |
176 | - TWindow |
177 | - "Smart placement" for new windows | |
cc99cba8 | 178 | |
a4406f4e | 179 | 0.0.5: BUG HUNT |
cc99cba8 | 180 | |
a4406f4e | 181 | - TSubMenu keyboard mnemonic not working |
e3dfbd23 | 182 | - Swing performance. Even with double buffering it isn't great. |
9edb442b | 183 | |
a4406f4e | 184 | 0.1.0: BETA RELEASE |
9edb442b | 185 | |
a4406f4e KL |
186 | - TSpinner |
187 | - TComboBox | |
188 | - TListBox | |
189 | - TCalendar | |
190 | - TColorPicker | |
7d4115a5 KL |
191 | |
192 | Wishlist features (2.0): | |
193 | ||
194 | - TTerminal | |
195 | - Handle resize events (pass to child process) | |
7d4115a5 KL |
196 | - Screen |
197 | - Allow complex characters in putCharXY() and detect them in putStrXY(). | |
7d4115a5 KL |
198 | - Drag and drop |
199 | - TEditor | |
200 | - TField | |
201 | - TText | |
202 | - TTerminal | |
203 | - TComboBox | |
92554d64 KL |
204 | |
205 | ||
206 | Screenshots | |
207 | ----------- | |
208 | ||
bb35d919 KL |
209 | ![Several Windows Open Including A Terminal](/screenshots/screenshot1.png?raw=true "Several Windows Open Including A Terminal") |
210 | ||
cf9af8df | 211 | ![Yo Dawg...](/screenshots/yodawg.png?raw=true "Yo Dawg, I heard you like text windowing systems, so I ran a text windowing system inside your text windowing system so you can have a terminal in your terminal.") |