mytimertask.java

来自「Huffman编码的java实现。含实验报告。」· Java 代码 · 共 59 行

JAVA
59
字号
package gilyou;
import java.util.TimerTask;

public class MyTimerTask extends TimerTask {
    public boolean done = false;
    public String message = null;
    String tip = null;
	public MyTimerTask(String tip){
		super();
		this.tip = tip;
	}
	public void run(){
		try{
			Main.infoTextArea.setText("\n\n\n\t\t" + tip + " . . . . . .");
			if(done){
				this.cancel();
				Main.infoTextArea.setText(message);
			}
			Thread.sleep(500);
			Main.infoTextArea.setText("\n\n\n\t\t" + tip + " .");
			if(done){
				this.cancel();
				Main.infoTextArea.setText(message);
			}
			Thread.sleep(500);
			Main.infoTextArea.setText("\n\n\n\t\t" + tip + " . .");
			if(done){
				this.cancel();
				Main.infoTextArea.setText(message);
			}
			if(done){
				this.cancel();
				Main.infoTextArea.setText(message);
			}
			Thread.sleep(500);
			Main.infoTextArea.setText("\n\n\n\t\t" + tip + " . . .");
			if(done){
				this.cancel();
				Main.infoTextArea.setText(message);
			}
			Thread.sleep(500); 
			Main.infoTextArea.setText("\n\n\n\t\t" + tip + " . . . .");
			if(done){
				this.cancel();
				Main.infoTextArea.setText(message);
			}
			Thread.sleep(500);
			Main.infoTextArea.setText("\n\n\n\t\t" + tip + " . . . . .");
			if(done){
				this.cancel();
				Main.infoTextArea.setText(message);
			}
		}catch(Exception e){
			e.printStackTrace();
		}
	}

}

⌨️ 快捷键说明

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