<div>Frame 안에 Panel이랑 Button이 있구요</div> <div>Button을 한 번 누를 때마다 Label을 하나씩 생성해서 Panel에 add시키는데요</div> <div>Frame의 repaint() 를 호출했는데 화면이 바뀌지 않아요 ㅜㅜ</div> <div>그런데 창을 최소화 시킨담에 다시 화면 크게 만드니까 그제서야 변경된 화면이 나와요 ㅜㅜ</div> <div> </div> <div>제가 뭔가 잘못알고있는건가요?</div> <div> </div> <div> </div> <div><span style="color: blue">import</span> java.awt.*; <br /><span style="color: blue">import</span> java.awt.event.*; <br /><br /><span style="color: blue">public</span> <span style="color: blue">class</span> Test2 { <br /> Frame f; <br /> Button b; <br /> Panel p; <br /> <br /> Test2(String title) { <br /> f = <span style="color: blue">new</span> Frame(title); <br /> f.addWindowListener(<span style="color: blue">new</span> WindowAdapter() { <br /> <span style="color: blue">public</span> <span style="color: blue">void</span> windowClosing(WindowEvent we) { <br /> System.exit(<span style="color: maroon">0</span>); <br /> } <br /> }); <br /> <br /> p = <span style="color: blue">new</span> Panel(); <br /> b = <span style="color: blue">new</span> Button(<span style="color: maroon">"click"</span>); <br /> b.addActionListener(<span style="color: blue">new</span> ButtonHandler()); <br /> <br /> f.add(p, <span style="color: maroon">"Center"</span>); <br /> f.add(b, <span style="color: maroon">"South"</span>); <br /> f.setBounds(<span style="color: maroon">100</span>,<span style="color: maroon">50</span>,<span style="color: maroon">500</span>,<span style="color: maroon">500</span>); <br /> f.setVisible(<span style="color: maroon">true</span>); <br /> } <br /> <br /> <span style="color: blue">public</span> <span style="color: blue">static</span> <span style="color: blue">void</span> main(String[] args) { <br /> <span style="color: blue">new</span> Test2(<span style="color: maroon">"repaint test"</span>); <br /> } <br /> <br /> <span style="color: blue">class</span> ButtonHandler <span style="color: blue">implements</span> ActionListener { <br /> <span style="color: blue">public</span> <span style="color: blue">void</span> actionPerformed(ActionEvent ae) { <br /> Label label = <span style="color: blue">new</span> Label(<span style="color: maroon">"hello"</span>); <br /> p.add(label); <br /> f.repaint(); <br /> } <br /> } <br />} </div>
<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>#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>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.