Article View: borland.public.jbuilder.java.swing
Article #98progress bar during a critical operation in the event dispatch thread
From: Tony
Date: Sun, 22 Jan 2006 07:40
Date: Sun, 22 Jan 2006 07:40
48 lines
1850 bytes
1850 bytes
Dear all,
I have a question that bothers me. I think I know the answer, but
it's simplicity is making me doubt my reasoning.
I would greatly appreciate if somebody more experienced
could chime in with an opinion.
Tony
Sample code that explains my problem:
startButton.addActionListener(new Action Listener()
{
public void actionPerformed(ActionEvent e)
{
method1();
method2();
}
}
);
method1()
{
/*
I have some long-running operations in this method.
Is it true that there is no way to display and
update a progress bar in this method?
*/
}
method2()
{
/*
This method contains operations that must not
be performed until method1 is finished
*/
}
My reasoning:
1. Display and updates of the progress bar are UI operations
which must take place on a Swing thread.
2. Swing thread will not resume until actionPerformed method
exits.
Technical Details
Message-ID:
<43d3363e$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news3.google.com!news.glorb.com!pln-w!lotsanews.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 111d45,dfff19faba996f35,start X-Google-Attributes: gid111d45,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Tony" <aoganesi_a^t_yahoo_._com> Newsgroups: borland.public.jbuilder.java.swing Subject: progress bar during a critical operation in the event dispatch thread Date: Sat, 21 Jan 2006 23:40:33 -0800 Lines: 50 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 NNTP-Posting-Host: 71.138.75.54 Message-ID: <43d3363e$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1137915454 71.138.75.54 (21 Jan 2006 23:37:34 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news3.google.com!news.glorb.com!pln-w!lotsanews.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail