Article View: borland.public.jbuilder.java.api
Article #699Re: Problem with JProgressBar
From: Nenko Ivanov
Date: Fri, 21 Feb 2003 09:54
Date: Fri, 21 Feb 2003 09:54
53 lines
2635 bytes
2635 bytes
Thanks Owen, I will try to follow your advice. Regards, Nenko. "Owen Green" <owen@begonefoulmachine.kennulz.demon.co.uk> wrote in message news:3e550e87@newsgroups.borland.com... > > "Nenko Ivanov" <nivanov@icygen.com> wrote in message > news:3e550986@newsgroups.borland.com... > > Hi everyone, > > I want to create an task status indicator with JProgressBar. > > I made one extended JDialog classs with a JProgressBar in it and when > my > > task starts I show this Dialog and tell the JPorgressBar to change > it's > > value to the desired one. > > Everything seemed to be OK, but the dialog show's up when my task is > > finished and it does't make sence ;) > > (The task is creating a big HTML file from known amount of data) > > So I am not very aquainted with Threads but I think that the answer > is > > somewhere there. > > Can anyone help me find the answer? > > Sounds like you do ineed need to be running your task in a seperate > thread. This will also mean that you need to take care with calls to GUI > elements, as these can louse things up if done from other threads - > SwingUtilities.invoke() and invokeAndWait() are nesscesary to safely > update widgets from threads other than the AWT event thread. > > There are a number of approches you could take, but an example could > involve > > 1)Define a class that represents your task (either with the threading > built in, or not (I'd go for not). > 2)Define a listener interface for your task (and the approptiate code in > your task class). > 3)Implement an instance of this listener and put the GUI updates in > there. > > -- > hth > Owen > > > > > > > >
Technical Details
Message-ID:
<3e55f6a9$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3e550986@newsgroups.borland.com> <3e550e87@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,147e7be8c5b83fd X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2003-02-21 02:12:01 PST From: "Nenko Ivanov" <nivanov@icygen.com> Newsgroups: borland.public.jbuilder.java.api References: <3e550986@newsgroups.borland.com> <3e550e87@newsgroups.borland.com> Subject: Re: Problem with JProgressBar Date: Fri, 21 Feb 2003 11:54:09 +0200 Lines: 55 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 NNTP-Posting-Host: 195.96.228.205 Message-ID: <3e55f6a9$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1045821097 195.96.228.205 (21 Feb 2003 01:51:37 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail