Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to set system.out.print caret at the same position?

Reply
Thread Tools

How to set system.out.print caret at the same position?

 
 
Camel
Guest
Posts: n/a
 
      07-12-2005
Hello all,

I have a console program that prints numbers. I want the newly printed
number replace old number at the same position. How can do it?

Thank you very much in advance.


 
Reply With Quote
 
 
 
 
Thomas Weidenfeller
Guest
Posts: n/a
 
      07-12-2005
Camel wrote:
> I have a console program that prints numbers. I want the newly printed
> number replace old number at the same position. How can do it?


In general you can't. Java is not well suited for console/terminal
emulator/text applications. You can consider to use a JNI-based library
like JCurses to get more control over the console. Or you could play
with the control codes for your particular terminal emulation.

/Thomas

--
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/...g/java/gui/faq
http://www.uni-giessen.de/faq/archiv....java.gui.faq/
 
Reply With Quote
 
 
 
 
Real Gagnon
Guest
Posts: n/a
 
      07-12-2005
> I have a console program that prints numbers. I want the newly printed
> number replace old number at the same position. How can do it?


Try to print a "backspace" character with something like

System.out.print("\b");

Bye.
--
Real Gagnon from Quebec, Canada
* Looking for Java or PB code examples ? Visit Real's How-to
* http://www.rgagnon.com/howto.html
 
Reply With Quote
 
Camel
Guest
Posts: n/a
 
      07-12-2005
The System.out.print("\b") works.

Thank you two very much.
"Real Gagnon" <realgagnon_@_yahooSpamIsBadSstripunderscore.com > wrote in
message news:Xns96916F6B93B5Frealhowtowwwrgagnonc@140.99.9 9.130...
>> I have a console program that prints numbers. I want the newly printed
>> number replace old number at the same position. How can do it?

>
> Try to print a "backspace" character with something like
>
> System.out.print("\b");
>
> Bye.
> --
> Real Gagnon from Quebec, Canada
> * Looking for Java or PB code examples ? Visit Real's How-to
> * http://www.rgagnon.com/howto.html



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set the caret to the next new line acu Java 0 05-15-2009 12:57 PM
Re: No caret with two items at same location (position:fixed) rf HTML 1 09-19-2008 11:42 PM
Re: No caret with two items at same location (position:fixed) Andy HTML 0 09-19-2008 12:42 PM
How to set caret position to end of textarea? R. Kangas Javascript 0 01-26-2006 03:21 PM
Set caret position cc Javascript 4 04-04-2005 06:30 PM



Advertisments