Article View: comp.lang.java.help
Article #71system.out.println() I need to know about "\t" and others....
From: Jobi
Date: Thu, 07 Sep 2000 23:04
Date: Thu, 07 Sep 2000 23:04
44 lines
2714 bytes
2714 bytes
Hi,
I have just finished a small java application but I would like to improve on
it a bit . I am trying to display some progress Information. Here is what I
would like the output to look like:
Zipping File: 14%
I would like to be able to change the 14% to its new value but all I seem to
be able to do is 14%15%16%......
is there a code I can Use? Here is my Class Definition:
import java.io.*;
public class ProgressStatus {
private short currentPercentage ;
private short newpPercentage ;
public ProgressStatus(String displayText) {
System.out.print(displayText+": 0%") ;
currentPercentage = 0 ;
System.out.flush() ;
}
public ProgressStatus(String displayText, long current, long total) {
System.out.print(displayText+": 0%") ;
currentPercentage = 0 ;
updateProgress(current, total) ;
}
public void updateProgress(long current, long total) {
newpPercentage = (short)((float)current/total*100) ;
if (newpPercentage != currentPercentage) {
//Update the new %
System.out.print("\b"+newpPercentage+"%") ;
//Update the Internal
currentPercentage = newpPercentage ;
System.out.flush() ;
}
}
}
I was hoping that there would be a "\?" available such as "\t" for Tabs
Any Ideas?
Thanks
ejodoin@home.com
Technical Details
Message-ID:
<J9Vt5.3862$x6.216193@news1.gvcl1.bc.home.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-east!supernews.com!news-feed.riddles.org.uk!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!news1.gvcl1.bc.home.com.POSTED!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d6b,eaca0815bc6f7f3b,start X-Google-Attributes: gid111d6b,public X-Google-Thread: f74b3,eaca0815bc6f7f3b,start X-Google-Attributes: gidf74b3,public X-Google-Thread: 113ae9,eaca0815bc6f7f3b,start X-Google-Attributes: gid113ae9,public X-Google-ArrivalTime: 2000-09-07 16:04:53 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-east!supernews.com!news-feed.riddles.org.uk!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!news1.gvcl1.bc.home.com.POSTED!not-for-mail Reply-To: "Jobi" <ejodoin@home.com> From: "Jobi" <ejodoin@home.com> Newsgroups: comp.lang.java.help,comp.lang.java.misc,borland.public.jbuilder.java.language Subject: system.out.println() I need to know about "\t" and others.... Lines: 46 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.5600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.5600 Message-ID: <J9Vt5.3862$x6.216193@news1.gvcl1.bc.home.com> Date: Thu, 07 Sep 2000 23:04:09 GMT NNTP-Posting-Host: 24.69.103.146 X-Complaints-To: abuse@home.net X-Trace: news1.gvcl1.bc.home.com 968367849 24.69.103.146 (Thu, 07 Sep 2000 16:04:09 PDT) NNTP-Posting-Date: Thu, 07 Sep 2000 16:04:09 PDT Organization: Excite@Home - The Leader in Broadband