Article View: borland.public.jbuilder.java.api
Article #1976Re: Freeze the screen
From: Ant�nio Ferreira
Date: Mon, 18 Jun 2001 08:55
Date: Mon, 18 Jun 2001 08:55
71 lines
2723 bytes
2723 bytes
Hi,
sorry for taking so long to answer your message. Here goes a code snippet:
public void refrescarCartas() {
if (this.terminouThread) {
this.terminouThread = false;
//inicializes progressbar
final ProgressBar1 bp = new
ProgressBar1(0,97+(this.jTabbedPaneCartas.getComponentCount()*8),"Actualiza�
�o das cartas");
bp.show();
final SwingWorker worker = new SwingWorker() {
public Object construct() {
refrescarCartasThread(bp);
return null;
}
};
worker.start();
}
}
public void refrescarCartasThread(ProgressBar bp) {
//unimportant code
...
//updates the progress bar by a value of 10
bp.updatevalue(10);
//it calls a method that re creates the screen
//I don�t intend to call the progress bar inside this method
//only after it, to simplify things
this.recreatescreen();
bp.updatevalue(50)
...
this.terminouThread = true;
}
I hope this can help.
Ant�nio Jos� Ferreira
"Torsten Welches" <torsten.welches@who.cares.netcologne.de> wrote in message
news:3b29bd14$1_1@dnews...
>
> Ant�nio,
>
> can you provide a code snippet that shows what you are doing?
>
> Torsten
>
> "Ant�nio Ferreira" <antonio.ferreira@artesis.co.pt> wrote:
> >Hi,
> >
> > I am using the swingworker to implement the progress bar but I am
having a
> >problem. During the execution of the thread I need to recreate the
screen.
> >Without the progress bar the screen is updated in the end but with the
> >progress bar this one is being updated while the thread is running. Is
there
> >something I can do to update the screen only when the thread is over?
> > I appreciate all your help.
> > Thanks,
> >
> > Ant�nio Jos� Ferreira
> >
> >
>
Technical Details
Message-ID:
<3b2dc16b_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!128.230.129.106!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnewsReferences:
<3b27452c_1@dnews> <3b29bd14$1_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 1089d0,18c80611e0e8e298 X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2001-06-18 02:01:16 PST From: "Ant�nio Ferreira" <antonio.ferreira@artesis.co.pt> Newsgroups: borland.public.jbuilder.java.api References: <3b27452c_1@dnews> <3b29bd14$1_1@dnews> Subject: Re: Freeze the screen Date: Mon, 18 Jun 2001 09:55:18 +0100 Lines: 73 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 NNTP-Posting-Host: 195.22.4.93 Message-ID: <3b2dc16b_1@dnews> X-Trace: dnews 992854379 195.22.4.93 (18 Jun 2001 01:52:59 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!128.230.129.106!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews