Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 786279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:00:58+00:00 2026-05-14T21:00:58+00:00

I am building a swing application. At some point, I have to start an

  • 0

I am building a swing application. At some point, I have to start an “animation”:

...
jpanel1.setBackground(Color.Black);

Delay(milli)   

jpanel1.setBackground(Color.White);
...

and so on.

The gui itself and all the logic behind it work.It is just this time depended color-changing that does not. I have read, that swing is not thread safe, but all the examples I found showed me how to start another thread (for example in the background) but never how to stop the current swing-gui thread.

Edit:

The application should work as following:

  1. configuration files are read, jframe is set up.
  2. some simple questions are beeing asked
  3. a dialogue is opened, which explains the animation.
  4. after the user clicked “ok” the animation – some color flashing – is started. the color and the delay between the color-changing is depended on the configuration
  5. another dialogue is opened and the programm continues -> new jpanel inside the jframe, buttons and so on.

the online thing that does not work are the delays between the color-changing. I understand now why it does not work and I am trying to build a timer, which activates a actionlister, which then changes the color and stops the timer… it just seems so much work for a simple delay… and I have to reorganize the entire animation in the application.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:00:59+00:00Added an answer on May 14, 2026 at 9:00 pm

    Take a look at: https://timingframework.dev.java.net/

    and the samples that come in http://filthyrichclients.org/

    They provide some very good information on how animation work and using the Timer framework. You’ll have a good understanding of how it works.

    I did a sample animation here with Swing after reading those:

    count down demo app http://img580.imageshack.us/img580/742/capturadepantalla201004wd.png
    Java application featuring blog.stackoverflow.com page ( click on image to see the demo video )

    But I’m not even sure what is what you want to achieve.

    EDIT

    I read about the timing framework to understand better what is all about, but I actually didn’t use it ( it is useful to create animations with no linear times – ie no every second as mine, but things like 1, 5, 3, 2 seconds )

    The code I’m using in the demo above is exactly this:

    final Timer imageTimer = new Timer();
    imageTimer.schedule( new TimerTask() {
        public void run() {
            changeImage();
        }
    }, 0, 10000 ); //<-- every 10 seconds. 
    

    The animation for the “stackoverflowing” and the count down use a similar approach.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Building a client-side swing application what should be notified on a bus (application-wide message
We have a huge Java Swing application. Now we want to remove couplings from
I'm building a little app using Java and Swing in NetBeans. Using NetBeans design
The naive way of writing building a menu in a Java Swing app is
Building the same project (without any changes) produces binary different exe-files: some small regions
When building some of my PHP apps, a lot of the functionality could be
Im building a web application which is a process management app. Several different employee
We're in the analysis/early design phase of a future Swing application where persistance is
Building on this question , now I have another problem. Given this, shipments =
Building on How Do You Express Binary Literals in Python , I was thinking

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.