Created
March 18, 2017 15:29
-
-
Save sjh836/65f0b3a1a775018b7a1cbd2a4cb9980f to your computer and use it in GitHub Desktop.
javax.swing.Timer 로 이벤트 반복1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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