Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-15-2008, 02:35 PM
Member
 
Join Date: Apr 2008
Posts: 1
wererabit is on a distinguished road
Animation Delay - Thread problem
This probably turns out a stupid question, but it's been driving me crazy. so PLEASE help out

Basically what I want is when the sign in button is clicked, the glass pane is turned on, shows some animation and when the rest done, turn it off.

because the rest is alot and so I put it in another thread.

The problem is that when the button is clicked, the classPane is turned on (like I expected), but the animation doesn't start immediately, Its only starts when the rest in another thread has finished (but at that point, the glasspane is already turned off). So what I have is just an image doing nothing and then disapears

This is the code

Code:
btnSignIn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //display the glasspane first setGlassPane(new MyGlassPane(newAnimatedIcon("images/LoginWaitingIcon.png"))); getupGlasPane.setVisible(true); //expected the glassPane shows (it does), and the animation starts (it doesnt) new Thread(new Runnable() //The animation only starts when this thread finished { public void run() { //DO THE REST setupGlasPane(false); //finish, turning off } }).start(); });
Is there a way I can force the animation starts immediately before the other thread starts?

Thank you so much
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-17-2008, 09:41 AM
sukatoa's Avatar
Senior Member
 
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 509
sukatoa is on a distinguished road
Send a message via Yahoo to sukatoa
Ok, this is my first time to see making a new Runnable inside the main class....

It is also safe you create another class and pass all the components, you can update the components there....

Have you also read about EventQueue?

Quote:
Is there a way I can force the animation starts immediately before the other thread starts?
Try ExecutorService.....

regards,
sukatoa
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Text Animation rossomandop@acm.org AWT / Swing 4 05-30-2008 04:34 AM
[SOLVED] HELP! Thread Problem nvidia NetBeans 4 05-24-2008 05:57 AM
Problem using thread +rmi in my homework IbrahimAbbas Threads and Synchronization 10 04-14-2008 10:24 PM
GridLayout with animation? tojas AWT / Swing 3 11-12-2007 11:16 PM
Animation with Animated GIF JavaBean Java 2D 1 06-07-2007 06:11 PM


All times are GMT +3. The time now is 12:46 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org