zoukankan      html  css  js  c++  java
  • Java code lib javax.swing,Timer定时任务

    /**
     * Created by LvJianwei on 2018/1/24.
     */
    
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.Date;
    import javax.swing.*;
    
    /**
     * @program: reflection
     * @description: Timer
     * @author: LvJianwei
     * @create: 2018-01-24 10:32
     **/
    public class TimerTest {
    
        public static void main(String[] args) {
            ActionListener listener = new TimePrinter();
            Timer timer=new Timer(1000,listener);
            timer.start();
            JOptionPane.showMessageDialog(null,"Quit program?");
            System.exit(0);
        }
    }
    
    class TimePrinter implements ActionListener{
        @Override
        public void actionPerformed(ActionEvent e) {
            System.out.println("At the tone,the time is "+new Date());
            Toolkit.getDefaultToolkit().beep();
        }
    }
  • 相关阅读:
    JS异错面试题
    CSG
    OBS工具汇总
    SFS OBS
    zookeeper配置文件
    zookeeper概念
    centos yum源问题三板斧
    nexus仓库
    SVN备份恢复
    ubuntu
  • 原文地址:https://www.cnblogs.com/lvjianwei/p/8340669.html
Copyright © 2011-2022 走看看