<div><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: green">밑에 코드에서 f.repaint()를 호출하든 안하든 똑같은 결과가 나오는데요...</span></div> <div><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: green">repaint()를 호출 안해도 제대로 출력되는 이유가... </span></div> <div><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: green">걍 자동적으로 repaint()가 호출되서 그런건가요?</span></div> <div><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: green"><br /></span></div> <div><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: green">책에서 </span></div><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: green"> <div>AWT쓰레드에 의해 자동적으로 화면이 갱신되는 상황은</div> <div>1. 처음 화면에 나타날 때</div> <div>2. 다른 화면에 가려져 있던 부분이 다시 화면에 나타날 때</div> <div>3. 아이콘화 되어 있다가 원래 크기로 화면에 나타날 때</div> <div>라고 되어있는데요, Frame의 타이틀(여기서는 시간이죠)이 바뀌는게 저 3가지에 들어가지는 않는거같아서요..</div> <div><br /></div> <div><br /></div> <div><br /></div>/* <br /> * 타이틀 바에 현재 시간을 출력하는 시계를 작성하는 예제입니당. <br /> * 쓰레드를 이용해서 1초마다 변경되도록 할거에요. <br /> * SimpleDateFormat을 사용할거에요. <br /> */</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">import</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> java.text.SimpleDateFormat; </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">import</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> java.util.*; </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">import</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> java.awt.*; </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">import</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> java.awt.event.*; </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">public</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">class</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> Boogi6 { </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> Frame f = </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">null</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal">; </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> SimpleDateFormat sdf = </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">null</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal">; </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> Date d = </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">null</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal">; </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">public</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">static</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">void</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> main(String[] args) { </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> Boogi6 boogi6 = </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">new</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> Boogi6(); </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> boogi6.go(); </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> } </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">public</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">void</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> go() { </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> d = </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">new</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> Date(); </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> sdf = </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">new</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> SimpleDateFormat(</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: maroon">"hh:mm:ss a"</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal">); </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> f = </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">new</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> Frame(sdf.format(d)); </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> f.addWindowListener(</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">new</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> WindowAdapter() { </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">public</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">void</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> windowClosing(WindowEvent we) { </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> System.exit(</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: maroon">0</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal">); </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> } </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> }); </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> f.setLocation(</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: maroon">400</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal">,</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: maroon">300</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal">); </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> f.setSize(</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: maroon">500</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal">, </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: maroon">50</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal">); </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> f.setVisible(</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: maroon">true</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal">); </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> Runnable r = </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">new</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> MyRunnable(); </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> Thread t = </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">new</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> Thread(r); </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> t.start(); </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> } </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">class</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> MyRunnable </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">implements</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> Runnable { </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">public</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">void</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> run() { </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> while(</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: maroon">true</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal">) { </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> d = </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">new</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> Date(); </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> f.setTitle(sdf.format(d)); </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: green">//f.repaint();</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">try</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> { </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> Thread.currentThread().sleep(</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: maroon">100</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal">); </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> } </span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal; color: blue">catch</span><span style="font-family: 'Courier New'; font-size: medium; line-height: normal">(InterruptedException e) {} </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> } </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> } </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal"> } </span><br style="font-family: 'Courier New'; font-size: medium; line-height: normal" /><span style="font-family: 'Courier New'; font-size: medium; line-height: normal">}</span>
<a href="http://blog.naver.com/finalboogi">
<img src="http://thimg.todayhumor.co.kr/upfile/201312/1387637645G9UumBQ6ZyDeaNnTpq.jpg"></a>
<style>#okNokBookDiv img{content:url("http://thimg.todayhumor.co.kr/upfile/201312/1387635212a6x9jURsp.jpg");}#okNokBookDiv img:nth-child(2){content:url("http://thimg.todayhumor.co.kr/upfile/201312/1387635212a6x9jURsp.jpg");}#okNokBookDiv a img{content:url("http://thimg.todayhumor.co.kr/upfile/201312/1387635212a6x9jURsp.jpg");}</style>
<STYLE> div.writerInfoBgMiddle {background-image:url(http://thimg.todayhumor.co.kr/upfile/201401/1389094315vQEcRW5LGs6zwzEn82Y2Ok.png);} </STYLE>
<STYLE>#login_span span b a:before{content: "글냥이의 사역마 ";}#memo_insert_ div b:before{content: "글냥이의 사역마 ";}</STYLE>
<style>textarea{background:url(http://thimg.todayhumor.co.kr/upfile/201401/1388604479R9q6U8rB8uCQHJVyexn6.png);background-position:bottom right;}</style>
<style>div.whole_box {background: url('http://postfiles2.naver.net/20140119_177/finalboogi_1390115067400zzy7d_PNG/64363453245234524.png?type=w2'); background-attachment: fixed; background-repeat: no-repeat; background-position: bottom left; background-size: 200px;}</style>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.