[¿¡·¯] ¸Þ½ÃÁö°¡ ³ª´Âµ¥¿ä Çѹø¸¸ ´õ ºÎŹµå¸³´Ï´Ù.


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]

±Û¾´ÀÌ :ÃÖÁ¾Ã¶ 1998³â 7¿ù 25ÀÏ 21:13:36

In Reply to: [´äº¯]¾ÖÇø´¿¡¼­ ÇÁ¸°Æ®ÇÏ´Â ¹ý°ú CardLayout ¿¹Á¦ posted by Á¶½ÅÁ¦ on 1998³â 7¿ù 25ÀÏ 20:10:52:

Á¶½ÅÁ¦´Ô²²¼­ ´äÇØÁֽŵ¥ ´ëÇؼ­ ´ë´ÜÈ÷ °¨»çµå¸³´Ï´Ù.
Àú´Â Áö±Ý jdk1.1.3À» ¾²°íÀִµ¥¿ä.


¿¡·¯¸Þ½ÃÁö°¡ ³ª°Åµç¿ä..
Á¦°¡ cardlayoutÀ» ½ÃÇèÄÚÀÚ ´ëÃæ ÇÑ °ÍÀε¥..
Çѹø¸¸ ºÁÁÖ¼¼¿ä...
------------ Ä«µå ·¹À̾ƿô --------
import java.awt.* ;
import java.awt.event.* ;


public class CL extends java.applet.Applet
implements ActionListener {


CardLayout cl = new CardLayout() ;
Panel p, p1, p2, cards ;


public void init() {


setLayout(new BorderLayout()) ;
cards = new Panel() ;
p = new Panel();


add("North", p) ;
add("Center", cards) ;


p = new Panel() ;
p.add(new Label("Select Panel !!")) ;
p.add(new Button("Btn1")) ;
p.add(new Button("Btn2")) ;


cards.setLayout(new CardLayout()) ;


p1 = new Panel() ;
p1.setLayout(new GridLayout(2,2,10,10)) ;
p1.add(new Button("Label 1")) ;
p1.add(new Button("Label 2")) ;
p1.add(new Button("Label 3")) ;
p1.add(new Button("Label 4")) ;
cards.add("P1", p1) ;


p2 = new Panel() ;
p2.setLayout(new GridLayout(4,1,10,10)) ;
p2.add(new Button("Label 1")) ;
p2.add(new Button("Label 2")) ;
p2.add(new Button("Label 3")) ;
p2.add(new Button("Label 4")) ;
cards.add("P2", p2) ;
} // init


public void actionPerformed (ActionEvent e) {
if (e.getSource() instanceof Button) {
String label = ((Button)e.getSource()).getLabel() ;
if (label == "Btn1") { cl.show(cards, "P1") ; }
if (label == "Btn2") { cl.show(cards, "P2") ; }
} // instanceof Button
} // actionPerformed



} // top


----------------------- Ä«µå·¹À̾ƿô --------


------ ±×¸®°í ÀÌ°ÍÀº ÇÁ¸°Æ® ¿¹Á¦ÀÔ´Ï´Ù -----
¾ÖÇø´À» ¾ÖÇø´ÀÚü¿¡¼­ ÇÁ¸°Æ®¸¦ ÇÒ¼ö ÀÖ°Ô²û
ÇØ¾ß Çϱ⤨¤Â¹®¿¡ ÀÌó·³ °£´ÜÇÏ°Ô ´ëÃæ ½ÇÇèÇÏ°íÀÚ
ÇÕ´Ï´Ù.


ÀÌ ¿¹Á¦¸¦ Çѹø¸¸ ºÁÁÖ¼¼¿ä.
Àú´Â ¼ö¸®È¯°æ ¸ðµ¨¸µÀ» Çؼ­, ³ª¿Â °á°ú¸¦
gifÈ­ÀÏ·Î ¸¸µç ´ÙÀ½¿¡ ÀÌ°ÍÀ» ¾ÖÇø´¿¡¼­
º¸ÀÌ°Ô ÇÒ·Á°í ÇÕ´Ï´Ù.
±× ´ÙÀ½¿¡ ÇÁ¸°Æ®¸¦ ÇØ¾ß Çϴµ¥, ÀÏ´Ü ¾Æ·¡ ¹æ¹ýÀÌ
Àß ÀÛµ¿ÇÏ°Ô µÇ¸é, µÉÅÙµ¥...
³Ê¹« ¾î·Æ½À´Ï´Ù.
±×·³ À̰͵µ ºÁÁÖ½Ã¸é ´ë´ÜÈ÷ °¨»çÇÏ°Ú½À´Ï´Ù.


------------- ÇÁ¸°Æ® ¿¹Á¦ ----------------
import java.awt.*;
import java.awt.event.* ;


public class PP extends java.applet.Applet implements ActionListener {


Label status = new Label("Print ME !!");
Button prbtn = new Button("PRINT APPLET") ;



public void init() {
setLayout(new FlowLayout(FlowLayout.CENTER,10,10)) ;
add(status) ;
add(prbtn) ;
prbtn.addActionListener(this) ;
} // init



public Insets getInsets() { return new Insets(10,10,10,10); }
public void start() { }
public void stop() { }


public void actionPerformed (ActionEvent e) {
if (e.getSource() instanceof Button) {
PrintJob job = getToolkit().getPrintJob(this, "Print Test",
null) ;
//(Properties)null) ;
if (job != null) {
Graphics pg = job.getGraphics() ;
if (pg != null) {
printAll(pg) ;
pg.dispose() ;
}
job.end() ;
}
} // instanceof Button
} // actionPerformed



} // top



------------- ÇÁ¸°Æ® ¿¹Á¦ ³¡ ---------------


¶Ç Çѹø ºÎŹµå¸®°Ú½À´Ï´Ù.
°¨»çÇÕ´Ï´Ù.


ÃÖÁ¾Ã¶


´ÙÀ½ ±Ûµé:



À̾ ±Û¿Ã¸®±â(´äÇϱâ)

À̸§:
E-Mail:
Á¦¸ñ:
³»¿ë:
°ü·Ã URL(¼±ÅÃ):
URL Á¦¸ñ(¼±ÅÃ):
°ü·Ã À̹ÌÁö URL:


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]