?? spstoolthread.java
字號:
package jp.co.ntl.ext;
import java.awt.AWTEventMulticaster;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
//import org.apache.log4j.Logger;
public class SPSToolThread extends Thread {
private final static int DEFAULT_PERIOD = 5000;
// private static Logger log = Logger.getLogger(SPSToolThread.class);
public final static String COM_SEND_EVENT = "SendEvent";
private boolean endThread = false;
private boolean sendEvent = true;
transient ActionListener actionListener;
private String actionCommand = "";
private int period = DEFAULT_PERIOD;
public SPSToolThread() {
this(DEFAULT_PERIOD);
}
public SPSToolThread(int period) {
this.period = period;
}
public void run() {
while (endThread == false) {
/// System.out.println(getClass().toString() + " sendEvent flag = " + sendEvent);
if (sendEvent) {
/// System.out.println("Thread timer period");
if (actionListener != null) {
// log.debug("New ActionEvent has been actionPerformed!");
setActionCommand(COM_SEND_EVENT);
actionListener.actionPerformed(
new ActionEvent(this, ActionEvent.ACTION_PERFORMED, actionCommand));
}
}
try {
Thread.sleep(period);
} catch (InterruptedException e) {
;
}
}
}
public void setActionCommand(String command) {
actionCommand = command;
}
public String getActionCommand() {
return actionCommand;
}
public synchronized void addActionListener(ActionListener al) {
actionListener = AWTEventMulticaster.add(actionListener, al);
}
public synchronized void removeActionListener(ActionListener al) {
actionListener = AWTEventMulticaster.remove(actionListener, al);
}
public synchronized void setEndThreadFlag(boolean endThread) {
this.endThread = endThread;
}
public synchronized void setSendEvent(boolean sendEvent) {
this.sendEvent = sendEvent;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -