타이머를 다시 시작하거나 특정 코드 행을 수행 한 후에 다른 지연을 추가해야합니다.Java Swing 재시작 타이머 작동 후
private static class ButtonHandler implements ActionListener {
public void actionPerformed (ActionEvent e) {
final JButton button = (JButton)e.getSource();
Timer timer = new Timer(1000, new ActionListener() {
public void actionPerformed(ActionEvent e) {
String tc = random();
them.setText("They chose: " + tc + "!");
if (button == rock) {
whoWins("rock", tc);
} else if (button == paper) {
whoWins("paper", tc);
} else if (button == scissors) {
whoWins("scissors", tc);
}
yourWins.setText("Your wins: " + yw);
theirWins.setText("Their wins: " + tw);
}
});
timer.setRepeats(false);
timer.start();
}
}
나는 내가 타이머를 다시 시작하는데 그렇다면 나는,이 작업을 수행하는 방법을 잘 모르겠습니다 아직까지
them.setText("they chose: " + tc + "!");
후 타이머의 제 2 지연을 구현하고자하는 곳에 나는 것 그 코드 줄을 써주시겠습니까? 미리 감사드립니다.
사용자 상호 작용없이 메시지가 표시된 직후 (그들은 ...를 선택했습니다). 그것은 기본적으로 화면에 첫 번째 메시지를 표시하는 데 오랜 시간이 걸리는 중간에 일시 중지 된 두 개의 지연이 있어야합니다. – patrickstarpants
더 이상 도움이 필요하지 않으므로 모든 도움을 주셔서 감사 드리며 드디어 간단한 프로그램을 개발할 수 있습니다. – patrickstarpants