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

Constructor Timer(int d,ActionListener l) doesn't throw IllegalArgumentException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.3.0
    • client-libs
    • beta
    • x86
    • windows_nt



      Name: yyT116575 Date: 12/01/2000


      Java(TM) 2 Runtime Environment,Standard Edition(build 1.3.0-C)
      Java HotSpot(TM) Client VM(build 1.3.0-C,mixed mode)

      1. The constructor for javax.swing.Timer, Timer(int delay,ActionListener
      listener) doesn't throw IllegalArgumentException for invalid delay, if delay is
      set less than zero.

      2. The sample code is,

         import javax.swing.*;
         import java.awt.event.*;
         class Test extends Thread implements ActionListener
         {
              public static void main(String args[])
              {
                  Test m = new Test();
                  m.start();
              }
              public void run()
              {
                  Timer m = new Timer(-2000,this);//here delay < 0
                  m.start();
                  while(true)
                  {
                      try
                      {
                          Thread.sleep(200);
                      }
                      catch(InterruptedException exp){}
                  }
               }
               public void actionPerformed(ActionEvent e)
               {
                  System.out.print(" Hello World ");
               }
         }
      (Review ID: 112976)
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            yyoungsunw Yung-ching Young (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: