Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

text based user interface

 
Brett Wiggins
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

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.

thanks.
 
Campbell Ritchie
Sheriff
Posts: 48910
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Too difficult a topic for us beginners.
Moving.
 
Joe Ess
Bartender
Posts: 9279
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Joe Ess
Bartender
Posts: 9279
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try the Java Curses library (curses is popular for building text interfaces on Unix). The examples look pretty impressive (character-based dialogs, scrolling lists, etc.).
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18152
52
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Brett Wiggins
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

Thanks for the help.I'll be checking out the java Curses Library.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic