Thread.sleep(1000);
-一般的に、EDTで行うのは良い考えではありません。タイマーを使用してみてください。
-後で電話する必要もありますrevalidate()/validate() and repaint()
。
だから多分このようなもの:
Timer yellowTimer = new Timer(1000,new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
jtp.setBackground(Color.YELLOW);
//call revalidate()/validate() and repaint() afterward
jtp.revalidate();
jtp.repaint();
}
});
yellowTimer.setRepeats(false);
Timer orangeTimer = new Timer(2000,new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
jtp.setBackground(Color.ORANGE);
//call revalidate()/validate() and repaint() afterward
jtp.revalidate();
jtp.repaint();
}
});
orangeTimer.setRepeats(false);
yellowTimer.start();
orangeTimer.start();