Results 1 to 4 of 4
Thread: Animation Delay - Thread problem
- 04-15-2008, 02:35 PM #1
Member
- Join Date
- Apr 2008
- Posts
- 1
- Rep Power
- 0
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
Java 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(); });
Thank you so much
- 04-17-2008, 09:41 AM #2
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?
Is there a way I can force the animation starts immediately before the other thread starts?
regards,
sukatoa
- 04-10-2009, 11:30 PM #3
Member
- Join Date
- Apr 2009
- Posts
- 1
- Rep Power
- 0
introduction Hello everyone I just joined
Hello everyone,
Nice Forum hoping to meet some new friends and learn how to use this forum
See you later
-
Similar Threads
-
Animation with Animated GIF
By JavaBean in forum Java 2DReplies: 3Last Post: 06-04-2011, 05:26 PM -
Text Animation
By rossomandop@acm.org in forum AWT / SwingReplies: 4Last Post: 05-30-2008, 04:34 AM -
[SOLVED] HELP! Thread Problem
By nvidia in forum NetBeansReplies: 2Last Post: 05-24-2008, 05:56 AM -
Problem using thread +rmi in my homework
By IbrahimAbbas in forum Threads and SynchronizationReplies: 10Last Post: 04-14-2008, 10:24 PM -
GridLayout with animation?
By tojas in forum AWT / SwingReplies: 3Last Post: 11-12-2007, 11:16 PM
Bookmarks