View Single Post
  #1 (permalink)  
Old 04-15-2008, 02:35 PM
wererabit wererabit is offline
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
Reply With Quote
Sponsored Links