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

  • Home
  • SEARCH
  • 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 6873731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:06:21+00:00 2026-05-27T04:06:21+00:00

I saw in another question regarding swing Timer API and your methods, preference stop();

  • 0

I saw in another question regarding swing Timer API and your methods, preference stop();
my question is, is it possible to stop (cancel if util.timer) a timer when it’s currently executing?

I have a timer and need to stop a thread when I call stop(), even if it is currently running.

  • 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-27T04:06:22+00:00Added an answer on May 27, 2026 at 4:06 am

    Yes, it is possible to stop a Swing Timer by calling stop(). That’s why this class has this method. Having said this, I have a feeling that there is more to your problem then you are telling us. But I don’t know what a Swing Timer has to do with “stopping threads”.

    Edit
    You state:

    my problem is, I have a swing timer and this execute another single method, that execute every 30 seconds, and I can execute the same single method manually, by the way, I want to stop swing timer when the manually method is running and when the manually method is finished, swing timer is started, because the timer can hinder other method. The main is the manually method.

    One possible solution: You could have the Swing Timer, but just enclose most of its code in an if statement controlled by a boolean say called, runTimer, so that the code in the Timer’s actionPerformed only runs if the boolean is true. Then run your background thread in a SwingWorker, but set the runTimer boolean to false before executing the SwingWorker, and then set it to true in the SwingWorker’s done() method.

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

Sidebar

Related Questions

Looking at learning some C since i saw in another SO question that is
I saw this tip in another question and was wondering if someone could explain
I saw this in an answer to another question , in reference to shortcomings
In another question, I saw the following syntax: #[unset!] What is that? If I
I saw a comment on another question (I forget which one) encouraging the asker
I saw from another question here : Determine iPhone user's country that it is
I saw this code in another question , I thought I might make it
So in a comment from another question , I just saw this example for
Sorry, lots of code coming up.. I saw another question like this that used
Recently saw someone commending another user on their use of sizeof var instead of

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.