Article View: borland.public.jbuilder.java.swing
Article #7921Re: status dialog with cancel button
From: Johan Forsberg
Date: Tue, 28 Nov 2000 00:00
Date: Tue, 28 Nov 2000 00:00
25 lines
1387 bytes
1387 bytes
"Zhining Zhang" <zzhang@serena.com> skrev i meddelandet
news:3A1ABFC4.EC817CA5@serena.com...
> My program has a big loop which may take 5 or 10 minutes. I need a
> status dialog with a cancel button, so that user can know status and can
> cancel anytime. It works just like a download dialog.
>
> How can I implement it? Thanks a lot!
In addition to looking up the other two replies, look up ProgressMonitor and
consider
using it. It's actually rather pretty.
<inside your Thread's run()>
public void run() {
ProgressMonitor prog=new ProgressMonitor(...);
while (lengthy) {
if (prog.isCanceled()) break;
prog.setProgress(p);
...
}
prog.close();
return;
}
Technical Details
Message-ID:
<900m5e$svf3@bornews.inprise.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3A1ABFC4.EC817CA5@serena.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,2d7fec89ddf09278 X-Google-Attributes: gid111d45,public From: "Johan Forsberg" <jfo@SPAMfinansforbundet.SPAMse> Subject: Re: status dialog with cancel button Date: 2000/11/28 Message-ID: <900m5e$svf3@bornews.inprise.com> X-Deja-AN: 698732190 Content-Transfer-Encoding: 7bit References: <3A1ABFC4.EC817CA5@serena.com> Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal X-Priority: 3 Content-Type: text/plain; charset="iso-8859-1" Mime-Version: 1.0 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Newsgroups: borland.public.jbuilder.java.swing