±Û¾´ÀÌ :ÀÓ°æÀç 1999³â 3¿ù 04ÀÏ 11:22:34
Áú¹®ÀÌ ÀÖ½À´Ï´Ù.
Æгξȿ¡ ¸î°³ÀÇ checkbox°¡ Àִµ¥¿ä,
ÀÌ ³»¿ëÀ» ¼¹ö¿¡¼ º¸³»´Â ³»¿ë¿¡ µû¶ó¼
´Ù½Ã »õ·Î¿î checkbox·Î °»½ÅÇÒ·Á°í ÇÕ´Ï´Ù.
¿¹¸¦ µé¾î ¹öÆ°ÀÌ 2°³ Àִµ¥ ù¹ø° ¹öÆ°À» ´©¸£¸é
¾î¶² URLÀ» ¼¹ö·Î º¸³»°í ¼¹ö¿¡¼ À̸¦ ¹Þ¾Æµé¿©¼ 󸮸¦ ÇÑ ´ÙÀ½¿¡
¾î¶² string ("chk1,chk2,chk3") À» º¸³»¸é
±âÁ¸ÀÇ Æгξȿ¡ ÀÖ´Â checkbox¸¦ ¸ðµÎ ¾ø¾Ö°í chk1, chk2, chk3ÀÇ
»õ·Î¿î checkbox¸¦ ¸¸µé°íÀÚ ÇÕ´Ï´Ù.
======
void loadCheckbox(Panel panel, String themename) {
StringTokenizer token = new StringTokenizer(themename, ",") ;
int total = token.countTokens() ;
panel.removeAll(); // To remove all checkbox and add themes
panel.validate() ;
CheckBoxListener myChkListener = new CheckBoxListener();
for (int i = 0 ; i < total ; i++) {
aCheckbox = null ;
String aTheme = (token.nextToken(",")) ;
aCheckbox= new Checkbox(aTheme) ;
aCheckbox.setState(true) ;
panel.add(aCheckbox) ;
aCheckbox.addItemListener(myChkListener);
}
panel.validate();
panel.repaint() ;
} // end of loadCheckbox
======
À§¿Í °°ÀÌ Çؼ
init¾È¿¡¼ loadCheckbox("test1,test2,test3") ÇÏ°Ô µÇ¸é
test1, test2, test3ÀÇ 3°³ÀÇ checkbox¸¦ »ý¼ºÇϴµ¥,
¹öÆ°À» ´·¯¼ loadCheckbox("chk1,chk2,chk3")ÀÌ·± ¸í·É¾î¸¦
½ÇÇàÇÏ°Ô²û ÇÏ¸é µÇÁö ¾Ê½À´Ï´Ù.
Ȥ½Ã ¾Æ½Ã´Â ºÐ°è½Ã¸é µµ¿òÀ» ÁֽʽÿÀ