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

java.awt.swing.Timer does not start under appletviewer.

XMLWordPrintable

    • sparc
    • solaris_2.5.1



      Name: aaC67449 Date: 02/11/98



      java.awt.swing.Timer does not start under appletviewer.
      This bug appears in JDK-1.2beta3-F. It works correctly in earlier versions.


      -------------------Example-----------------------------------
      import java.awt.swing.*;
      import java.awt.event.*;
      import java.applet.*;

      public class Test1 extends Applet{
         boolean flag=false;
         public void init() {
           ActionListener l=new ActionListener(){
             public void actionPerformed(ActionEvent e){
                 System.out.println("Passed");
                 flag=true;
             }
           };

           Timer c= new Timer(100,l);
           c.setRepeats(false);
           c.start(); // start timer
           try {
             Thread.sleep(1000); // wait
          } catch(InterruptedException e) {
            System.out.println("Unexpected "+e);
          }
          if(!flag) // verify the timer worked
                System.out.println("Failed");

        }
         public static void main(String argv[]) {
            (new Test1()).init();
         }


      }

      -------------------Output------------------------------------
      # Under appletviewer
      #>appletviewer test1.html
      Failed
      ^C
      #>java Test1
      Passed
      ^C

      ======================================================================

            jeff Jeff Dinkins
            aalievsunw Artem Aliev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: