Results 1 to 4 of 4
  1. #1
    wererabit is offline Member
    Join Date
    Apr 2008
    Rep Power

    Default 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
    Is there a way I can force the animation starts immediately before the other thread starts?

    Thank you so much

  2. #2
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Cebu City, Philippines
    Rep Power


    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?
    Try ExecutorService.....


  3. #3
    metricathome is offline Member
    Join Date
    Apr 2009
    Rep Power

    Default 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

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    These types of posts belong in the announcements forums. Please don't resurrect long-dead posts just for this.

Similar Threads

  1. Animation with Animated GIF
    By JavaBean in forum Java 2D
    Replies: 3
    Last Post: 06-04-2011, 04:26 PM
  2. Text Animation
    By in forum AWT / Swing
    Replies: 4
    Last Post: 05-30-2008, 03:34 AM
  3. [SOLVED] HELP! Thread Problem
    By nvidia in forum NetBeans
    Replies: 2
    Last Post: 05-24-2008, 04:56 AM
  4. Problem using thread +rmi in my homework
    By IbrahimAbbas in forum Threads and Synchronization
    Replies: 10
    Last Post: 04-14-2008, 09:24 PM
  5. GridLayout with animation?
    By tojas in forum AWT / Swing
    Replies: 3
    Last Post: 11-12-2007, 10:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts