• Post Reply Bookmark Topic Watch Topic
  • New Topic

display on same location System.out.print  RSS feed

 
Tim Cerillo
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using System.out.print, how can I display a text in the same position as the previous text display?

I have the following code:
for (loop condition){
System.out.print("Record#: " + recno++);
}

I want it to overwrite the previous text and just display it on the same position. Thanks.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Java console officially doesn't support such a thing in a platform-independent way.

But if you're on Windows, you can google for "ANSI.SYS" and read about special escape codes you can print to control cursor position and color and such.
 
Tim Cerillo
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Stan.

Is there any workaround in java?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!