?? stopwatch.java
字號(hào):
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 ) ) ); } }
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -