troubleshooting Question

Countdown timer

Avatar of sargent240
sargent240Flag for United States of America asked on
24 Comments1 Solution664 ViewsLast Modified:
I have code for a countdown timer I am trying to make work as a clock on a basketball scoreboard.  When I do c.start() the timer starts counting down and when I do c.stop() it stops.  The problem is when I do c.start() to start it up again I need it to continue counting down from where it was when I stopped it.  It just hangs up and that is it.  What do I need to do?  I am using Linux.  Thanks.

        public class CountDownThread  extends Thread implements ActionListener {
            private volatile int hour;
            private volatile int min;
            private volatile int seconds;
            private volatile long count;
            private volatile int i;
            private volatile DateFormat df;
            private volatile javax.swing.Timer t;
            private Object javax;

            public CountDownThread( int h, int m, int s ) {
                hour = s;
                min = m;
                seconds = s;
                count = 0;              
                t = new javax.swing.Timer(1000, this);
            public void run() {

      // suppose to show as in 01 HR 30 MIN 30 SEC.
       count = 0;
       t = new javax.swing.Timer(1000, this);

      Calendar cal = Calendar.getInstance();
      cal.set(Calendar.HOUR_OF_DAY, hours);
      cal.set(Calendar.MINUTE, min);
      cal.set(Calendar.SECOND, seconds);
       count = cal.getTime().getTime();
      df = new SimpleDateFormat("mm:ss");

     public void actionPerformed(ActionEvent e) {
      // suppose to countdown till OO HR 00 MIN 00 SEC
       if (clockRunning == 1) {
          if (t.isRunning()) {
              clockRunning = 0;
          } else {
      } else {
        count -= 1000;
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 24 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 24 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros