tags:

views:

365

answers:

2

Does Java support controlling the cursor when outputting to a console? For example, I'd like to set the character position, and possibly color, before doing a System.out.print(). Think of the way an application like top writes to the console. Thanks!

A: 

Not directly. In the old days ANSI escape sequences was supported, but not anymore.

I would suggest you look into a good Java Curses library supporting Windows. I cannot recommend any :(

Thorbjørn Ravn Andersen
+1  A: 

you usually do not use system.out to do these things. most applications in *nix use NCURSES (http://en.wikipedia.org/wiki/Ncurses) for this. You can try http://sourceforge.net/projects/javacurses/ if you need something this smart.

However, you can always sysout backspace (\b) characters if you want to delete what you wanted, and hope for the best

Nir Levy