±Û¾´ÀÌ :±èÅÂÈÆ 1998³â 6¿ù 10ÀÏ 16:36:50
In Reply to: [Áú¹®]ºê¶ó¿ìÀú¿¡¼... ´ÙÀ̾ó·Î±× ¹Ú½º°¡ posted by ±ÇÇØÈ¿ on 1998³â 6¿ù 10ÀÏ 13:07:03:
µµ¿òÀÌ µÉÁö ¸ð¸£°Ú½À´Ï´Ù.
¸ÕÀú ¾ÖÇø´À» °è½Â¹Þ¾Æ¼ init()¿¡¼ ´ÙÀ̾ó·Î±× ÀνºÅϽº¸¦ ¸¸µé¾î¼
´ÙÀ̾ó·Î±× ¹Ú½º¸¦ ¸¸µå´Â °ÍÀÌ ¾î¶³±î »ý°¢ÇÕ´Ï´Ù.
±×·¯³ª ºÒÇàÈ÷µµ ¾ÖÇø´Àº ÀÛµ¿ÇÏ°í ÀÖ´Â À©µµ¿ì°¡ ¹«¾ùÀÎÁö ¾Ë¼ö ¾øÀ¸¹Ç·Î
´ÙÀ̾ó·Î±×¸¦ »ç¿ëÇÒ¼ö ¾ø½À´Ï´Ù. ´Ù¸¸ ¾ÖÇø´ÀÌ ÀÚüÀûÀ¸·Î À©µµ¿ì( frame °´Ã¼)¸¦ »ý¼º
Çϸé ÀÌ À©µµ¿ì¿¡ Á¾¼ÓµÇ´Â ´ÙÀ̾ó·Î±×¸¦ °¡Áú¼ö ÀÖ½À´Ï´Ù.
Áï ¾ÖÇø´À» ¸¸µé¾î¼ ¾ÖÇø´Àº ÇÁ·¹ÀÓÀ» »ý¼ºÇÑÈÄ ±× ÇÁ·¹ÀÓ¿¡ ´ÙÀ̾ó·Î±× ¹Ú½º¸¦ ¸¸µå´Â °ÍÀÔ´Ï´Ù.
¾Æ·¡´Â ¹öÆ° Ŭ¸¯½Ã ´ÙÀ̾ó·Î±×°¡ ¶ß´Â ¿¹Á¦ÀÔ´Ï´Ù. awt1.1±âÁØ
void resBT_MouseClick(java.awt.event.MouseEvent event)
{
// to do: code goes here.
// frameÀÇ »ý¼º
Frame f = new Frame();
Dialog d = new Dialog(f,"¿¹¾à");
reserve r = new reserve(d);
d.setLocation( 100, 100 );
d.setSize(250,300);
d.setVisible(true);
}
reserve class ´Â ±×³É ´Ü¼øÇÑ Å¬·¹½ºÀε¥ ´ÜÁö ´ÙÀ̾ó·Î±×ÀÇ °´Ã¼ÀÎ d¸¦ Àμö·Î
³Ñ°Ü ¹Þ¾Æ¼ °Å±â¿¡ ¿©·¯ ÄÄÆ÷³ÍÆ®µéÀ» ¸¸µé°Ô µË´Ï´Ù.
public class reserve
{
Frame f;
public reserve(Frame fr,) // »ý¼ºÀÚ
{
f = fr;
button2 = new java.awt.Button();
button2.setLabel("´Ý±â");
button2.setBounds(144,228,76,24);
button2.setBackground(new Color(12632256));
f.add(button2);
}
}
ÀÌ¿Ü¿¡µµ ´ÙÀ̾ó·Î±×¸¦ °è½Â¹ÞÀº Ŭ·¹½ºÀÇ ÀνºÅϽº¸¦ ¸¸µå´Â ¹æ¹ýÀÔ´Ï´Ù.
if ( dialog == null) {
dialog = new SimpleDialog(this,"a simple");
}
dialog.show();
´ÙÀ½Àº simpleDialog °´Ã¼ÀÔ´Ï´Ù.
class SimpleDialog extends Dialog{
TextField field;
SimpleDialog(Frame dw,String title){
super(dw,title,false);
parent = (DialogWindow)dw;
... // create and add component
pack();
}
..... etc action() and other method
}
Àú´Â ¹öÆ°À» ´©¸¦½Ã ÇÁ·¹ÀÓÀÌ ¶ß´Â ·Î±×ÀÎ ºñ½ÁÇÑ °ÍÀº ¸¸µé¾î ºÃ´Âµ¥ ºñ½ÁÇÑ °ÍÀ̾î¼
¸îÀÚ Àû¾î ºÃ½À´Ï´Ù.
µµ¿òÀÌ µÇ¾ú±æ...