0

Hello StackOverflow...

This is a difficult question to word but I will attempt my hardest. Okay, If I were to make a piece of software run in the command line that would show the status of certain variables, is there any way that I could update what is drawn without adding extra lines to the screen.

Example :

-----------------------------
|   COMMAND LINE INTERFACE  |
-----------------------------

VARIABLE 1 <TRUE>  // I would like to update this variable without creating extra lines
VARIABLE 2 <FALSE>

<--------------------------->

Thanks Guys, Hope you understand...

DaForce
  • 1
  • 2
  • You're looking to rewrite to the screen in arbitrary locations? – nanofarad Oct 12 '13 at 12:18
  • I don't believe it is possible. You could try to simulate it by clearing the output, but then again: how do you differentiate between the command line and the IDE's output? – Jeroen Vannevel Oct 12 '13 at 12:18
  • I also don't believe it to be possible. The output is (at least, conceptually) a stream, and I don't think you can go back and forth in a stream. – afsantos Oct 12 '13 at 12:19
  • 1
    If you use a library like [JCurses](http://sourceforge.net/projects/javacurses/) then you could do that. Whether that still counts as a commandline application is debatable however – Boris the Spider Oct 12 '13 at 12:20
  • Wild idea, add a number in front of each vars, print everything and ask what variable needs an update (with the number) –  Oct 12 '13 at 12:28

1 Answers1

0

You can wipe out contents on screen and re-write using System.out.println. This will give a feel that new lines are not being written. You can refer How to delete stuff printed to console by System.out.println()?

Community
  • 1
  • 1
Shishir Pandey
  • 293
  • 2
  • 9