Article View: borland.public.jbuilder.java.swing
Article #9689Re: What class to use for a StatusBar?
From: Paul Furbacher [TeamB]
Date: Wed, 16 Feb 2000 00:00
Date: Wed, 16 Feb 2000 00:00
26 lines
1461 bytes
1461 bytes
Tor Iver Wilhelmsen wrote:
>
> "Sweder Schellens" <sweder.schellens@qa-systems.com> writes:
>
> > JLabel statusBar = new JLabel();
> > statusBar.setText("Scanning " + directory.toString());
> >
> > The problem is that the status bar doesn't display anything at all.
> > It looks like an update problem.
> > What am I doing wrong?
>
> You are calling setText() while in the AWT event thread. The actual
> update in the GUI won't happen until the thread finishes with your
> code and gets to the repaint() event pending.
>
> Solution: Do the actual "work" in a separate thread.
To amplify on this just slightly, see this article on
using the SwingWorkerThread:
http://java.sun.com/products/jfc/tsc/articles/threads/threads2.html
Paul Furbacher (TeamB)
Technical Details
Message-ID:
<38AAED72.5BD43B87@home.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<88b0si$j5j6@bornews.borland.com> <uael2g2p1.fsf@sds.no> <88bfs8$jd01@bornews.borland.com> <uk8k5nyne.fsf@sds.no>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,85b51552b2a3f7ef X-Google-Attributes: gid111d45,public From: "Paul Furbacher [TeamB]" <pnf@home.com> Subject: Re: What class to use for a StatusBar? Date: 2000/02/16 Message-ID: <38AAED72.5BD43B87@home.com> X-Deja-AN: 586616477 Content-Transfer-Encoding: 7bit References: <88b0si$j5j6@bornews.borland.com> <uael2g2p1.fsf@sds.no> <88bfs8$jd01@bornews.borland.com> <uk8k5nyne.fsf@sds.no> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Reply-To: pnf@home.com Newsgroups: borland.public.jbuilder.java.swing