🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.swing
3 messages
3 total messages Started by Zvonko Wed, 05 Apr 2006 07:18
Newbie need details for jProgressBar
#146
Author: Zvonko
Date: Wed, 05 Apr 2006 07:18
15 lines
1347 bytes
hi!

    I would like some details in implemeting a jProgressBar while geting 
data from database. It is very complicated for me to understand all this 
thread stuff (i worked in Delphi before, and there you just give the 
progressBar min, max and current value and it works). If someone would be so 
kind to help me.

    I am working in JBuilder and am a newbie. I need an example how to use 
progreesBar (or monitor) in a method inside a class, and call this method 
from actionPerformed of a button!?


Thanks guys.
Zvonko 
Re: Newbie need details for jProgressBar
#147
Author: Doychin Bondzhev
Date: Wed, 05 Apr 2006 13:04
31 lines
2027 bytes
If you come from Delphi then you know that when you want to update some 
property in a VCL control you have to do this in the main thread and for 
that purpose in TThread you have Synchronize method that you use to call 
other methods which should be executed in the context of the main thread.

In java you have to follow the same rules but here it is a little bit 
different. The way it is done is by use methods called invokeLater and 
invokeAndWait

These 2 methods are static and are defined in SwingUtilities class.

Doychin

Zvonko wrote:
> hi!
> 
>     I would like some details in implemeting a jProgressBar while geting 
> data from database. It is very complicated for me to understand all this 
> thread stuff (i worked in Delphi before, and there you just give the 
> progressBar min, max and current value and it works). If someone would be so 
> kind to help me.
> 
>     I am working in JBuilder and am a newbie. I need an example how to use 
> progreesBar (or monitor) in a method inside a class, and call this method 
> from actionPerformed of a button!?
> 
> 
> Thanks guys.
> Zvonko 
> 
> 
Re: Newbie need details for jProgressBar
#148
Author: Paul Furbacher [TeamB]
Date: Wed, 05 Apr 2006 14:15
39 lines
2354 bytes
Doychin Bondzhev wrote:

> If you come from Delphi then you know that when you want to update some 
> property in a VCL control you have to do this in the main thread and for 
> that purpose in TThread you have Synchronize method that you use to call 
> other methods which should be executed in the context of the main thread.
> 
> In java you have to follow the same rules but here it is a little bit 
> different. The way it is done is by use methods called invokeLater and 
> invokeAndWait
> 
> These 2 methods are static and are defined in SwingUtilities class.

In addition, there is a tutorial on JProgressBar which discusses this:

http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html
http://java.sun.com/developer/TechTips/2000/tt0912.html#tip2


The Swing Tutorial may be of general interest to both newcomers and
experienced hands who haven't done Swing in a while (myself included):

http://java.sun.com/developer/technicalArticles/GUI/swingtut/index.html


-- 


Paul Furbacher (TeamB)

   Save time, search the archives:
        http://info.borland.com/newsgroups/ngsearch.html

   Is it in Joi Ellis's Faq-O-Matic?
        http://www.visi.com/~gyles19/fom-serve/cache/1.html

   Finally, please send responses to the newsgroup only.
   That means, do not send email directly to me.
   Thank you.
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