Please join us at the new JavaWorld Q&A Forums. Your existing login will work there. The discussions here are now read-only.


JavaWorld Talkback >> Swing threading and the event dispatch thread

Pages: 1

Unregistered




So how do you show startup progress bars, now?
      #52139 - 08/23/07 01:51 AM

If all the gui components need to be constructed on EDT, how do you show a startup progress bar while you are setting up the rest of the application (typically loading and constructing the other gui classes)

Post Extras: Print Post   Remind Me!   Notify Moderator  
JohnZ
Unregistered




Re: So how do you show startup progress bars, now? [Re: Anonymous]
      #52146 - 08/23/07 05:55 AM

This is done as part of the splash screen.

See the example here:

http://java.sun.com/developer/JDCTechTips/2005/tt1115.html


Post Extras: Print Post   Remind Me!   Notify Moderator  

Unregistered




Re: So how do you show startup progress bars, now? [Re: JohnZ]
      #52151 - 08/23/07 08:57 AM

I'd suggest a less restrictive rule:

Execute outside the UI thread all the initialization except the event handling configuration.

This is:

on a parallel thread:
button.setCaption(...)
button.setSize(...)
frame.add(button)

and serializing the execution og:
button.addCommandListener(...)
frame.addXListener(...)

that ensures that the code that can enqueue UI-thread-executed workers is executed from the UI-thread. This code is the event-handling code, but all the component-creation code remains in parallel.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:   

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating: ***
Topic views: 4422

Rate this topic

Jump to

Contact us JavaWorld

Powered by UBB.threads™ 6.5.5