⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timertest.java

📁 this is my java Test
💻 JAVA
字号:
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.Timer;
//to resolve conflict with java.util.Timer
public class TimerTest
{
	public static void main(String [] args)
	{
		ActionListener listener=new TimerPrinter();
		//construct a timer that calls the listener
		//once every 10 seconds
		Timer t=new Timer(10000,listener);
		t.start();
		JOptionPane.showMessageDialog(null,"Quit program?");
		System.exit(0);
	}
}
class TimerPrinter implements ActionListener
{
	public void actionPerformed(ActionEvent Event)
	{Date now=new Date();
		System.out.println("At the tone,the time is"+now);
		Toolkit.getDefaultToolkit().beep();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -