java多线程制作计时器

基本思路:

在类中创建thread 供按钮监听器调用。

界面设计:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAACWCAIAAADrOSKFAAAgAElEQVR4nO29eXQc1f3o2f/NnJk3Z96bN++8Cav5/QIJGOwEIwwEYxuDd0lWO5gQAoEMODiBn38kGIOXBBMICF7yw4MNNraspffaq2vpWnpf1OpWt1q9qTfJkmzJkmzLkmzZJsA7nj+qu1TqzZKthdj1Od8jl25fd91bXR/dW3Vv3VZcyZHJZDAMq9yoXLr08YqKx5Y8uDQbS7Lx0JKlDz20tKJi6cMPL3344aVLH146iYcffvjhhysqKioqKh566KGHHnqoIsfDk1m6dOnSRx555JFH83jssccefbRUSHjk0UceefSRRx5duvQRaTyy9JFHHnlkaTkemfeQucl57LHHqqur9Xp9R0eHqJ7iypUrly5d4nn+qafWaLWGZCL19eWvv7789cWLl/JiSlycElN7rzJ7KYgZocRb5Y7A3DE+O8xgCb/99tvf/OY33800Bw4cmNk3/PLfXp3ZN7wenl+z6ttvv41GowaDYcWKFUajcXx8PCshz/O///3r7e2RgYHBUChsszkLw25z2u1OhyMbIi6Xy+VyOh1Z7Ha73W4Xt3PJDklml8vlcrvdHo+neRLeifB4PZJwu5vd7ma3y+N0epwOj8PmttvcVotLCIvZaTE7rRanxeKwWhxWq8NmdVotDovFbjHbrRa71WK3WOwWS3bbarVbrXarxZYXlslhNlvNZqvFbLWYrWaz1cxbxOB5C89bOM6cDdbMsmaW5VmWZxk+t8GxLMcwLMOwJhPLmBiGYUwmMUwmk4nOQdETUBRFURSZg8hhNBqNRiOO4ziOYxJQFEVRVJqC47jRaBT+FymByiHsyCSBycFK4CbD8zzP8+YcAwMDGzZsOH36dNfVOD5lhoaGPvroo9HR0an/F5HuYgwNDR147ddD4WAXqO4C1T2QuhdW98LqPljdD6v7YdUQrBqCVWdg1TCsGoYbR+DGUbhxrHSMFvw6AjcOw43DsOosrDoDq4Zg1SCs6odV/bD6JJzdXQ+k7gLVAz73c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MzS4gSih5OklBoImUJZWRmjzwJNRpNVsKHHnpoaGhINFCtVodCoU8//VQpIyMzo3z66aehUEgUTaPRnD9//q677lJUVFQMDg6KEqpUKo7jQqFQh4S4jIzMNSH1KBQKcRynUqlED7MS7ty5M5lMMgwjGCjSlKOxNA03EPXzzVQKWeazmBazfTCnyPfzIF8bZY62qJLUL7VaTZJkKpV69dVXFU1NTSAIdnZ2Co1hnoFlJJy9+swLc39CFHLVQs6UhN+rT/D7dpCvmatKKPVQrVan02mtVvv5558rIpHIY489FolE/H6/IOFNaKDIHJ8Q0z0/bkgJG25KD5ubm9vb2xctWuTz+RRXrlyBIGjbtm2RSCSTyfA8f7N1RKXM8dlwbefHDSbh9/MgXxtljraoFcMw6XS6vb39xRdfbGhouHLliuLKlSsXLlwAQXDp0qUGg6G9vf3smTMjQ0PnZWRkZoFUKqVWqxctWtTQ0DA2NpaVUKCtre2rr75atWrVj3/843vuueeHMjIyM83dd9/9xBNP7N+/3+fzier9/ydP/GYcHcIhAAAAAElFTkSuQmCC" alt="" />

代码:

 package thread;

 import java.awt.*;
import java.awt.event.*; import javax.swing.*; public class Threadtest extends JFrame implements Runnable{
JFrame frm=new JFrame("watch");
JPanel bottom=new JPanel();
JPanel mid=new JPanel();
JLabel h=new JLabel("0");
JLabel biao=new JLabel(":");
JLabel s=new JLabel("00");
JButton hajime=new JButton("开始计时");
JButton pause=new JButton("暂停");
JButton tozero=new JButton("清零");
Thread t=new Thread(this);
private int i=0,j=0;
public void run(){
try
{
while(true){
Thread.sleep(100);
i++;
if(i>=1&&i<10)
{
s.setText("0"+i);
}
else if(i>=10&&i<60)
s.setText(""+i);
if(i==60)
{
i=0;
j++;
s.setText("00");
h.setText(""+j);
}
}
}catch(Exception e){
System.out.println("");
}
}
public Threadtest()
{
frm.setLayout(new BorderLayout());
frm.setBounds(200, 200, 300, 150);
frm.setVisible(true);
frm.add("South",bottom);
frm.add("Center",mid); mid.add(h);
mid.add(biao);
mid.add(s);
h.setFont(new Font("Consulas",Font.PLAIN,36));
biao.setFont(new Font("Consulas",Font.PLAIN,36));
s.setFont(new Font("Consulas",Font.PLAIN,36));
bottom.add(hajime);
bottom.add(pause);
bottom.add(tozero); hajime.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
if(t.isAlive())
t.resume();
else t.start();
}});
pause.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
t.suspend();
}});
tozero.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
h.setText("0");
s.setText("00");
i=0;
j=0;
}
});
} public static void main(String[] args){
new Threadtest();
}
}
上一篇:win10环境下tensorflow-gpu安装


下一篇:[Luogu4174][NOI2006]最大获益