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 3438084
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:08:39+00:00 2026-05-18T08:08:39+00:00

IN SHORT: I want to execute a new command 3 sec after the former

  • 0

IN SHORT: I want to execute a new command 3 sec after the former command had been issued.

THE STORY:
I have an action button that once pressed sets (replaces) an Icon Image (an animaition) on one of the Jlabels.

JLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iamg/slash.gif")));

All I want is to replace the Icon back to the former one after X time passes. In other words I want the new animaition to finish (which is about 4 sec long) and after those 4 sec pass I could set a new Icon.

I realize this can be done with threads unforutly I have no idea how, since all I know is stopping the whole program using something like this:

try
{
    Thread.sleep(3000);      
}
catch (InterruptedException ex)
{

}

Which is stopping the animation it self as well, instead of waiting till 3 sec pass before executing the new command.. Help please?

  • 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-18T08:08:39+00:00Added an answer on May 18, 2026 at 8:08 am

    You should use a Timer. See this tutorial for how to use them. Basically you need to add an action listener to the timer, so that when it fires you can replace the icon.

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

Sidebar

Related Questions

In short: I want to monitor selected calls from an application to a DLL.
Short version: I want to trigger the Form_Load() event without making the form visible.
Short version: assuming I don't want to keep the data for long, how do
I want to display dates in the format: short day of week, short month,
Does NSBeep() exist on the iPhone? I just want to play a short error
I have a linked list that I want to sort part of, eg: std::sort(someIterator,
I have an input file that I want to sort based on timestamp which
I have a huge tab separated file which I want to sort on its
I have a list of Python objects that I want to sort by a
I want to execute a function that is inside the jquery document ready closure.

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.