Skip to content

Instantly share code, notes, and snippets.

@sjh836
Created March 18, 2017 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjh836/65f0b3a1a775018b7a1cbd2a4cb9980f to your computer and use it in GitHub Desktop.
Save sjh836/65f0b3a1a775018b7a1cbd2a4cb9980f to your computer and use it in GitHub Desktop.
javax.swing.Timer 로 이벤트 반복1
import java.awt.event.ActionListener;
import javax.swing.Timer;
public class TimerStudyApp {
public static void main(String[] args) {
ActionListener listener = new TimerStudy();
Timer t=new Timer(2000, listener);
t.start();
System.out.println("메인쓰레드 START");
for(int i=0;i<10;i++)
{
try{
System.out.println("반복문"+i);
Thread.sleep(1000);
}
catch(InterruptedException e){
}
}
System.out.println("메인쓰레드 END");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment