Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5056533

javax.swing.timer stops after changing actual system time

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P4
    • 7
    • 1.4.0, 1.4.2, 5.0
    • client-libs
    • generic, x86
    • generic, windows_2000, windows_xp

    Description

      Name: gm110360 Date: 06/02/2004


      FULL PRODUCT VERSION :
      java version "1.5.0-beta2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
      Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP Pro 32 bit +Service Pack 1

      A DESCRIPTION OF THE PROBLEM :
      I used javax.swing.timer and added ActionListener. After that I started timer and counted "ticks" of this timer. Everything goes well untill I change the system time (for example it's 5:00 and I set 4:23). After increasing time nothing happens but after decreasing it - timer stops - it just doesn't notify the action listener - actionPerformed method isn't called.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Define javax.swing.timer, add ActionListener, start timer, change time for the lower one and that's it.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      actionPerformed method is still called
      ACTUAL -
      actionPerformed method isn't called any longer

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.event.ActionListener;
      import java.awt.event.ActionEvent;
      import javax.swing.Timer;
      import java.awt.Frame;

      public class TimerTest
      {
      public static void main(String[] args)
      {
      Tester tester = new Tester();

      }
      }

      class Tester extends Frame
      {
      public Tester()
      {
      super();
      Timer t = new Timer(100, new
      ActionListener(){
      int i = 0;
      public void actionPerformed(ActionEvent e)
      {
      System.out.println("i=: " + i++);
      }

      });
      t.start(); //this te beggining and the end
      show();


      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Using own timer constructed with Thread but it's not very good solution.
      (Incident Review ID: 275579)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              idk Igor Kushnirskiy (Inactive)
              gmanwanisunw Girish Manwani (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: