What's a Good Java, Curses-Like, Library For Terminal Applications

What's a good Java, curses-like, library for terminal applications?

There is Charva, which links to native code but has an api based on Swing.
The screenshots show lots of text windows, so that looks useful.

What's the best way to get text user-interfaces (ncurses-like) functionality in Java?

Since 2010 there is Lanterna :

Lanterna is a Java library allowing you to write easy semi-graphical user interfaces in a text-only environment, very similar to the C library curses but with more functionality. Lanterna is supporting xterm compatible terminals and terminal emulators such as konsole, gnome-terminal, putty, xterm and many more. One of the main benefits of lanterna is that it's not dependent on any native library but runs 100% in pure Java.

More here: https://github.com/mabe02/lanterna

Is it possible in Java to show the results of a for loop in only one Output?

Yes, use print rather than println and add a "\r" at the end of each output:

e.g. System.out.println(i + ":0" + j + "\r");

When you use println it does 2 things: moves onto the next line (line feed) and returns the cursor to the start of the line (carriage return). Think of it like a typewriter :-)

If you manually print "\r" (just the carriage return) without advancing to the next line then the next thing you print will overwrite the previous contents of the line.



Related Topics



Leave a reply



Submit