0
타이머가 0에 도달하면 창에서 요소, 특히 레이블과 텍스트 영역을 제거하려고합니다. 그러나 타이머가 0에 도달했을 때이 메서드를 호출하면 예외가 발생합니다.타이머가 0에 도달하면 창에서 요소를 제거 하시겠습니까?
Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Not on FX application thread; currentThread = AWT-EventQueue-0
코드 :
ActionListener timeListener = new ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
gameTime--;
System.out.println(gameTime);
if(gameTime == 0){
endGame();
}
}
};
최종회() 메소드 : 당신은 AWT 액션 이벤트를 사용하는
public void endGame(){
timer.stop();
System.out.println("Score: " + score);
view.gamePane.getChildren().removeAll(view.lblQuestion, view.tfAnswer);
}
대단히 감사합니다! 이것은 치료를 일했다 :) – DHz