🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.api
3 messages
3 total messages Started by Nenko Ivanov Thu, 20 Feb 2003 17:02
Problem with JProgressBar
#696
Author: Nenko Ivanov
Date: Thu, 20 Feb 2003 17:02
12 lines
1485 bytes
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?
Thanks in advance.
Re: Problem with JProgressBar
#697
Author: Owen Green
Date: Thu, 20 Feb 2003 17:19
37 lines
2467 bytes
"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
Re: Problem with JProgressBar
#699
Author: Nenko Ivanov
Date: Fri, 21 Feb 2003 09:54
53 lines
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
>
>
>
>
>
>
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads