๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #1978

Re: Freeze the screen

#1978
From: Torsten Welches
Date: Mon, 18 Jun 2001 11:19
23 lines
1754 bytes
"Ant๏ฟฝnio Ferreira" <antonio.ferreira@artesis.co.pt> wrote:
>      final ProgressBar1 bp = new
>ProgressBar1(0,97+(this.jTabbedPaneCartas.getComponentCount()>*8),"Cards actualization");
>      bp.show();
>      final SwingWorker worker = new SwingWorker() {
>          public Object construct() {
>              refreshCardsThread(bp);
>              return null;
>          }
>      };
>      worker.start();

you are refreshing the ProgressBar on the SwingWorker's 
background thread - SwingWorker.construct is running on it's 
own thread. You are not "allowed" to do that, you rather have 
to run all ui-relevant stuff on the event dispatch thread.
http://java.sun.com/docs/books/tutorial/uiswing/overview/threads.html#rule

The article shows how to use SwingUtilities.invokeLater to 
ensure this.

Torsten
Technical Details
Message-ID: <3b2de3a8$1_2@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews
References: <3b27452c_1@dnews> <3b29bd14$1_1@dnews> <3b2dd800_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 04:33:23 PST
From: "Torsten Welches" <torsten.welches@who.cares.netcologne.de>
Sender: "Torsten Welches" <torsten.welches@who.cares.netcologne.de>
Reply-To: "Torsten Welches" <torsten.welches@who.cares.netcologne.de>
Subject: Re: Freeze the screen
Newsgroups: borland.public.jbuilder.java.api
X-User-Info: 193.158.55.74 193.158.55.74    
References:  <3b27452c_1@dnews>  <3b29bd14$1_1@dnews>  <3b2dd800_1@dnews> 
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3b2de3a8$1_2@dnews>
Date: 18 Jun 2001 04:19:04 -0700
X-Trace: dnews 992863144 207.105.83.65 (18 Jun 2001 04:19:04 -0700)
Lines: 23
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews