JAVA秒表,可定时到秒!
Java秒表,实现了以秒计时和以圈计时!
话不多说,上源码!
package timerDemo;import java.awt.BorderLayout;public class TimerCountDemo extends JPanel implements Runnable,ActionListener{private ScrollPane scrollPane;private TextArea resultTimeText;private JLabel currentTimeLabel;private Calendar currentCalendar;private Date currentDate;private JButton startJButton;private JButton quanJButton;private JButton secondButton;private JButton stopJButton;private JButton showTimeJButton;private Thread t;private static int i=1; //圈数private static int hour,min,sec,msec,totalTime;private static boolean flag=true;public TimerCountDemo() {// TODO Auto-generated constructor stubstartJButton=new JButton("开始");showTimeJButton=new JButton("00-00-00");showTimeJButton.setBackground(SystemColor.activeCaption);showTimeJButton.setFont(new Font("叶根友钢笔行书升级版", Font.PLAIN, 14));quanJButton=new JButton("以圈计时");quanJButton.setEnabled(false); //初始化时设为falsesecondButton=new JButton("以秒计时");secondButton.setEnabled(false); //初始化时设为falsestopJButton=new JButton("停止");stopJButton.setBackground(Color.red); //设置背景色为红色scrollPane=new ScrollPane();resultTimeText=new TextArea(20,20);
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
