JLabelに現在の日付と時刻を表示するTimerTaskを作成しました。以下はTimerTaskコードであり、通常のシナリオでうまく機能します。GUIの実行中にシステムの日付と時刻を変更すると、タイマーの実行が停止します。システムの日付と時刻を変更したときに例外はなく、タイマーの実行が停止しました。誰かが何が起こっているのか教えてもらえますか?
private void startTimer()
{
// Start the clock
timer = new Timer();
timer.schedule(new TimeTask(), 0, 1000);
}
class TimeTask extends TimerTask
{
public void run()
{
try {
clockLabel.setText(new SimpleDateFormat("EEE , dd MMM , HH:mm:ss").format(Calendar.getInstance().getTime()));
System.out.println(clockLabel.getText());
} catch(Exception ex) {
ex.printStackTrace();
System.out.println("Exception : " + ex.getMessage());
}
}
}