Thursday, 20 September 2012

Timer в Java.


package my.getTime;

public class getTime extends javax.swing.JFrame {

    /**
     * Creates new form getTime
     */
    public getTime() {
     
         new javax.swing.Timer(500, actionListener).start();        // "500"-500ms; start timer
       
   }

                 

    java.awt.event.ActionListener actionListener = new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent actionEvent) {
                             
                 // code

              }
   };    

     
    public  static void main(String args[]) {
        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {

                new getTime().setVisible(true);

            }
        });
    }


}

No comments:

Post a Comment