📄 timethread.java
字号:
package ATM_ToolClass;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import ATM_Frame.ATM_window;
public class TimeThread extends Thread{
ATM_window awindow;
public TimeThread(ATM_window aw){
awindow=aw;
setDaemon(true);
}
public void run(){
while(true){
if(ATM_window.getRestTime()==0){
JOptionPane.showMessageDialog(awindow, "操作时间已到,磁卡已被没收","操作失败提示!!!",JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
JLabel restTime=new JLabel("剩余时间: "+ATM_window.getRestTime());
restTime.setBounds(150, 220, 100, 25);
awindow.getTopPane().add(restTime);
awindow.getTopPane().repaint();
try {
sleep(1000);
} catch (InterruptedException e) {
}
ATM_window.setRestTime();
awindow.getTopPane().remove(restTime);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -