我正在创建一个以登录公式开头的程序。我想让整个程序停止并在 5 小时后再次显示此登录公式。为此,我使用 Timer。
public class MainClass implements ActionListener{
private final Timer timer = new Timer(30000, this);
public static void main(String args[]){
timer.start();
new JLogin();
}
//If time time-out
public void actionPerformed(ActionEvent e) {
timer.stop();
new Mainclass();
}
当我写它时,它在我调用“timer.start()”时显示错误。错误说:“在静态()中更改定时器()的修饰符。发生这种情况的任何原因?