±Û¾´ÀÌ :ÀÌÈñÁ¤ 1998³â 4¿ù 27ÀÏ 20:31:30
In Reply to: GridBagLayout »ç¿ë posted by ¿ÀÇö°æ on 1998³â 4¿ù 14ÀÏ 21:16:53:
¾È³çÇϼ¼¿ä. ÀÌÈñÁ¤ÀÔ´Ï´Ù.
Àúµµ ÀßÀº ¸ð¸£Áö¸¸... À̹ø¿¡ Á¶±Ý °øºÎ¸¦ Ç߱⿡
ÀÌ·¸°Ô ±ÛÀ» ¿Ã¸³´Ï´Ù...^^;(¾¦½º·´³×¿ä...)
¿ì¼±, Çö°æ´ÔÀÌ ÇÏ½Ç µðÀÚÀÎÀº 4°³ÀÇ Çʵå¿Í
4°³ÀÇ ÇàÀ¸·Î ³ª´©¼Å¾ß °Ú³×¿ä.
Á¦°¡ ¸¸µç °£´ÜÇÑ Sample Code¸¦ ¾µ²²¿ä.
µµ¿òÀÌ µÇ¼ÌÀ¸¸é ÁÁ°Ú¾î¿ä... ^_^
import java.awt.*;
import corejava.*;
public class Input_screen extends Frame
{ private void add(Component c, GridBagLayout gbl,
GridBagConstraints gbc,
int x, int y, int w, int h)
{ gbc.gridx = x;
gbc.gridy = y;
gbc.gridwidth = w;
gbc.gridheight = h;
gbl.setConstraints(c, gbc);
add(c);
}
public Input_screen()
{ setTitle("ÀÏÀÏ °èȹ ÀÔ·ÂÇϱâ");
GridBagLayout gbl = new GridBagLayout();
setLayout(gbl);
Label work_label = new Label(" ÇÒ ÀÏ:");
Label content_label = new Label(" ÇÒÀϼ³¸í:");
Label start_label = new Label(" ¾ðÁ¦ºÎÅÍ:");
Label end_label = new Label(" ¾ðÁ¦±îÁö:");
Label imfort_label = new Label(" Áß¿äÇØ? :");
TextField work_tf = new TextField(" ",20);
TextField content_tf = new TextField(" ",20);
TextField start_tf = new TextField(" ",20);
TextField end_tf = new TextField(" ",20);
imfort_ch = new Choice();
imfort_ch.addItem("¾ÆÁÖ Áß¿ä");
imfort_ch.addItem("Áß ¿ä");
imfort_ch.addItem("º¸ Åë");
imfort_ch.addItem("Áß¿äÇÏÁö ¾ÊÀ½");
confirm_ck = new Checkbox(" ´ÙÀ½ºÎÅÍ ¹¯Áö ¾Ê±â");
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.BOTH;
gbc.weightx = 100;
gbc.weighty = 100;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.WEST;
add(work_label, gbl, gbc, 0, 1, 1, 1);
add(content_label, gbl, gbc, 0, 2, 1, 1);
add(start_label, gbl, gbc, 0, 3, 1, 1);
add(end_label, gbl, gbc, 0, 4, 1, 1);
add(imfort_label, gbl, gbc, 0, 5, 1, 1);
add(work_tf, gbl, gbc, 1, 1, 4, 1);
add(content_tf, gbl, gbc, 1, 2, 4, 1);
add(start_tf, gbl, gbc, 1, 3, 4, 1);
add(end_tf, gbl, gbc, 1, 4, 4, 1);
add(imfort_ch, gbl, gbc, 1, 5, 4, 1);
gbc.anchor = GridBagConstraints.WEST;
add(confirm_ck, gbl, gbc, 1, 7, 2, 1);
add(new Button(" µî ·Ï "),gbl, gbc, 0, 7, 1, 1);
}
public boolean handleEvent(Event evt)
{ if (evt.id == Event.WINDOW_DESTROY) System.exit(0);
return super.handleEvent(evt);
}
public boolean action(Event evt, Object arg)
{ return super.action(evt, arg);
}
public static void main(String[] args)
{ Frame f = new Input_screen();
f.resize(250, 200);
f.show();
}
private TextField work_tf;
private TextField content_tf;
private TextField start_tf;
private TextField end_tf;
private Choice imfort_ch;
private Checkbox confirm_ck;
}
ÀÚ¼¼ÇÑ ³»¿ëÀº Ã¥ÀÌ ¾ø¾î¼ ¼³¸íÀ» µå¸®Áö ¸øÇÏ°Ú¾î¿ä.
ÀÚ¼¼È÷´Â Àúµµ ¸ð¸£°Åµç¿ä.
±×³É °øºÎÇÏ¸é¼ ¸¸µé¾î º»°Å¿¹¿ä.
³»ÀÏÀÌ¶óµµ Ã¥À» °¡Á®¿Í¼ ´Ù½Ã ´äÀ» ¿Ã·Áº¸µµ·Ï
ÇÒ²²¿ä. Ưº°ÇÑ ÀÏÀÌ »ý±âÁö ¾ÊÀ¸¸é¿ä...
±×·³, ÁÁÀº ÇÏ·çµÇ¼¼¿ä...