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

📄 stopwatch.java

📁 简介: 今天为网友提供的是JAVA源码
💻 JAVA
字号:
package com.power.pipeengine;/** * <p>Title: PIPE Engine</p> * <p>Description: Global Planning Optimization Engine</p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: Paraster, Inc.</p> * @author unascribed * @version 1.0 */import java.util.*;import com.power.util.Message.*;import java.text.*;import javax.swing.*;import com.power.pipeengine.EngineUI.*;import java.awt.*;public class StopWatch extends TimerTask {    public StopWatch( JLabel aLabel ) {        myLabel = aLabel;        myLabel.setText( sdfInput.format( new Date( 0 ) ) );        myLabel.setForeground( Color.blue );    }    private Date startDate = new Date();    public long elapsedTime = 0;    private long startTime = startDate.getTime();    private SimpleDateFormat sdfInput = new SimpleDateFormat( "mm:ss:SSS" );    private JLabel myLabel;// = new JLabel();    public void run() {        elapsedTime = new Date().getTime() - startTime;        myLabel.setText( sdfInput.format( new Date( elapsedTime) ) );        //myDisplay.repaint( myDisplay.getX(), myDisplay.getY(),          //                 myDisplay.getWidth(), myDisplay.getHeight() );        /*try {            //SwingUtilities.invokeLater( runnable );            SwingUtilities.invokeLater( UIEventUpdateThread.getInstance() );            } catch (Exception e ) {}*/    }    public JLabel getLabel() {        return myLabel;    }    public void reset() {        elapsedTime = 0;        myLabel.setText( sdfInput.format( new Date( 0 ) ) );    } }

⌨️ 快捷键说明

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