Results 1 to 6 of 6
- 12-11-2007, 10:23 PM #1
Member
- Join Date
- Dec 2007
- Posts
- 2
- Rep Power
- 0
how to print output on same line in 'while loop'?
I have a 'while loop' that prints on a new line everytime;
system.out.println("bla bla bla:" + N)
output i have:
count 1
count 2
count 3......and so on
what i want to do is print on the same line and display the count in real time,
instead of on a new line.
using 'print' instead of 'println' prints every thing all in one long line.
I imagine i could clear/erase the line and print a new line in the 'while loop'
but not sure how to do that.
output i want:
count x: have the numbers change in realtime instead of on a new line.
right now it's a command line program but want to update to a gui/pop up box.
- 12-11-2007, 11:39 PM #2
When you upgrade to a GUI, you will abandon System.out.println all together. The text box that you use inside of your GUI will have a text attribute and you will change that instead of printing the text. If I were you, I wouldn't worry about making this change when you are still running from the command line.
- 12-12-2007, 07:24 PM #3
Member
- Join Date
- Dec 2007
- Posts
- 2
- Rep Power
- 0
thanks for the reply.
but to cure my curiosity was i at least on the right track?
would still like to try it.
- 12-12-2007, 08:00 PM #4
Senior Member
- Join Date
- Nov 2007
- Location
- Newport, WA
- Posts
- 141
- Rep Power
- 0
No, there is no way to change something that has already been printed to the console. Not unless you use some sort of a native library, java cant do that.
- 12-12-2007, 11:04 PM #5
Member
- Join Date
- Aug 2007
- Posts
- 30
- Rep Power
- 0
If you'd really like to try it, you could use the Curses for Java library... On SourceForge, but it hasn't been updated in five years - meaning either it's that good, or it's unsupported. I've used ncurses in C, never tried this in Java... Like is mentioned above, I go straight to the UI.
Don.Don MacVittie F5 Networks - DevCentral
- 12-13-2007, 02:30 AM #6
Senior Member
- Join Date
- Nov 2007
- Location
- Newport, WA
- Posts
- 141
- Rep Power
- 0
Similar Threads
-
print line
By kazitula in forum Java AppletsReplies: 2Last Post: 01-26-2008, 02:05 PM -
output
By Camden in forum New To JavaReplies: 3Last Post: 12-01-2007, 10:34 PM -
Reading in data from file line by line
By bluekswing in forum New To JavaReplies: 1Last Post: 10-02-2007, 12:19 AM -
Print XML tag
By DonCash in forum XMLReplies: 2Last Post: 08-07-2007, 06:02 PM -
Print A Pdf
By Jack in forum Advanced JavaReplies: 2Last Post: 07-02-2007, 05:40 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks