반응형 전체 글223 자바 소스코드: 스레드 상태 알기 package javaapplication23; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class ThreadMainEx{ ThreadMainEx(){ long id =Thread.currentThread().getId(); String name = Thread.currentThread().getName(); int priority =Thread.currentThread().getPriority(); Thread.State s = Thread.currentThread().getState(); System.out.println("현재 스레드 이름="+name); System.ou.. 2016. 11. 14. 자바 소스코드: FlickeringLabel 예제 package javaapplication22; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class FlickeringLabelEx extends JFrame{ FlickeringLabelEx(){ this.setTitle("FlickeringLabel 예제"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLayout(new FlowLayout()); FlickeringLabel fl = new FlickeringLabel("깜빡");//깜빡이는 레이블 생성 JLabel la = new JLabel("안깜빡");/.. 2016. 11. 14. 자바 소스코드: Runnable 예제(Timer) package javaapplication21; import java.awt.*; import javax.swing.*; class TimerRunnable implements Runnable{ int n=0; public void run(){ while(true){ System.out.print(n++); try{ Thread.sleep(1000); } catch(Exception e){ return; } } } } public class JavaApplication21 { public static void main(String[] args) { Thread th = new Thread(new TimerRunnable()); th.start(); } } 2016/11/12 - [자바] - 자바 소스코드.. 2016. 11. 12. 자바 소스코드: ThreadTimer 예제 package javaapplication20; import java.awt.*; import javax.swing.*; class ThreadTimerEx extends JFrame{ JLabel la; ThreadTimerEx(){ this.setTitle("ThreadTimer 예제"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLayout(new FlowLayout()); MyThread th = new MyThread(); la=new JLabel(); la.setFont(new Font("Gothic", Font.ITALIC, 80)); this.add(la); this.setLocationRelativeTo(null); th.. 2016. 11. 12. 이전 1 ··· 25 26 27 28 29 30 31 ··· 56 다음 반응형