; 나는 "Continuous"버튼이 rollthedice()를 시작하고 "Stop"버튼을 눌러 멈추고 싶다. 그러나 "Continuous"버튼을 다시 누르면 다시 rollthedice()가 시작된다.ScheduleThreadPoolExecutor를 사용하기위한 적절한 구문을 보여줄 수 있습니까? 이 경우
scheduler = new ScheduledThreadPoolExecutor(1);
ScheduledFuture now = null;
Runnable runner = new Runnable(){
public void run()
{
rollthedice();
}
};
if(e.getSource()==continuous)
{
now = scheduler.scheduleAtFixedRate(runner, 0, 500, TimeUnit.MILLISECONDS);
}
if(e.getSource()==stop)
{
now.cancel(true);
}
Google 검색을 시도해 보셨습니까 ... – Joel
"연속 버튼 누르기"란 무엇을 의미합니까? 사용자가 이벤트를 생성합니까? 어떻게 그걸합니까? – Arham
"stop"과 "continuous"버튼이있는 JFrame GUI이 코드는 actionPerformed – JRowan