This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I have started writing a small application to run on a Linux Shell Server and am wondering if there is a way to make a text-only user interface. The program has a few threads that process I/O from a server as well as input from the user. All input and output are printed and captured to the console and what I would like to do is split the console into different sections so server I/O would be printed in one section and user input could be typed in another section.
Java has poor console support. Consoles are very OS (and in Unix, shell) specific and Java tries to be platform-independent.
That said, you can use ASCII control characters, like 0x0d (carriage return) or 0x08 (backspace) to control the cursor on a single line. If your console recognizes ANSI escape sequences(I believe bash does), they allow greater flexibility.
If you want a fully-featured GUI, use AWT or Swing.
Actually, a true console should be considered as having all the graphics capabilities of a Teletype machine. Which is to say, virtually none. However most "glass TTY" devices (and the console windows that simulate them) are more flexible than that.
As Joe pointed out, there's system called "curses" that's designed to replace the wide variety of vendor-specific terminal control codes (escape sequences) with a standardized text-mode UI. While these days you could generally get by using the ANSI escape sequences, curses makes the process much more civilized.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Mar 23, 2009
Thanks for the help.I'll be checking out the java Curses Library.