JAVA»ù´¡££JAVAÖеķ´Éä»úÖÆÏê½â
תÌù£ºhttp://java.ccidnet.com/art/3539/20070924/1222147_1.html
JAVA·´Éä»úÖÆ
JAVA·´Éä»úÖÆÊÇÔÚÔËÐÐ״̬ÖУ¬¶ÔÓÚÈÎÒâÒ»¸öÀ࣬¶¼Äܹ»ÖªµÀÕâ¸öÀàµÄËùÓÐÊôÐԺͷ½·¨£»¶ÔÓÚÈÎÒâÒ»¸ö¶ÔÏ󣬶¼Äܹ»µ÷ÓÃËüµÄÈÎÒâÒ»¸ö·½·¨£»ÕâÖÖ¶¯Ì¬»ñÈ¡µÄÐÅÏ¢ÒÔ¼°¶¯Ì¬µ÷ÓöÔÏóµÄ·½·¨µÄ¹¦ÄܳÆΪjavaÓïÑԵķ´Éä»úÖÆ¡£
Java·´Éä»úÖÆÖ÷ÒªÌṩÁËÒÔϹ¦ÄÜ£º ÔÚÔËÐÐʱÅжÏÈÎÒâÒ»¸ö¶ÔÏóËùÊôµÄÀࣻÔÚÔËÐÐʱ¹¹ÔìÈÎÒâÒ»¸öÀàµÄ¶ÔÏó£»ÔÚÔËÐÐʱÅжÏÈÎÒâÒ»¸öÀàËù¾ßÓеijÉÔ±±äÁ¿ºÍ·½·¨£»ÔÚÔËÐÐʱµ÷ÓÃÈÎÒâÒ»¸ö¶ÔÏóµÄ·½·¨£»Éú³É¶¯Ì¬´úÀí¡£
1. µÃµ½Ä³¸ö¶ÔÏóµÄÊôÐÔ
1 public Object getProperty(Object owner, String fieldName) throws Exception {
2 Class ownerClass = owner.getClass();
3
4 Field field = ownerClass.getField(fieldName);
5
6 Object property = field.get(owner);
7
8 return property;
9 }
Class ownerClass = owner.getClass()£ºµÃµ½¸Ã¶ÔÏóµÄClass¡£
Field field = ownerClass.getField(fieldName)£ºÍ¨¹ýClassµÃµ½ÀàÉùÃ÷µÄÊôÐÔ¡£
Object property = field.get(owner)£ºÍ¨¹ý¶ÔÏóµÃµ½¸ÃÊôÐÔµÄʵÀý£¬Èç¹ûÕâ¸öÊôÐÔÊǷǹ«Óеģ¬ÕâÀï»á±¨IllegalAccessException¡£
2. µÃµ½Ä³¸öÀàµÄ¾²Ì¬ÊôÐÔ
1 public Object getStaticProperty(String className, String fieldName)
2 throws Exception {
3 Class ownerClass = Class.forName(className);
4
5 Field field = ownerClass.getField(fieldName);
6
7 Object property = field.get(ownerClass);
8
9 return property;
10 }
Class ownerClass = Cla
Ïà¹ØÎĵµ£º
jar Ó¦Óà ÏÈ´ò¿ªÃüÁîÌáʾ·û(win2000»òÔÚÔËÐпðÀïÖ´ÐÐcmdÃüÁwin98ΪDOSÌáʾ·û)£¬ÊäÈëjar
-help,È»ºó»Ø³µ(Èç¹ûÄãÅÌÉÏÒѾÓÐÁËjdk1.1»òÒÔÉÏ°æ±¾)£¬¿´µ½Ê²Ã´£º
Ó÷¨£ºjar {ctxu}[vfm0Mi] [jar-Îļþ]
[manifest-Îļþ] [-C Ŀ¼] ÎļþÃû ...
Ñ¡Ï
-c ´´½¨ÐµĴ浵
-t Áгö´æµµÄÚÈݵÄÁбí
-x
Õ¹¿ª´æµµÖеÄÃüÃûµ ......
JAVA¿ª·¢Õß×ȥµÄ20¸öÓ¢ÎÄÍøÕ¾
2009Äê09ÔÂ01ÈÕ 09:56 ·ÖÀࣺJava×ÊѶ ä¯ÀÀ£º 33,388 ´Î
JAVA¿ª·¢Õß×ȥµÄ20¸öÓ¢ÎÄÍøÕ¾
1.[http://www.javaalmanac.com] – Java¿ª·¢ÕßÄê¼øÒ»ÊéµÄÔÚÏß°æ±¾. ÒªÏë¿ìËٲ鵽ijÖÖJava¼¼ÇɵÄÓ÷¨¼°Ê¾Àý´úÂë, ÕâÊÇÒ»¸ö²»´íµÄÈ¥ ......
¢AWT£ºAbstract Window Toolkit
¢GUI£º Graphical User Interface
ͨ¹ýÌṩ²Ëµ¥¡¢°´Å¥¡¢±êÇ©±êʶ¡¢Êó±êµÈ£¬Íê³É¶Ô¼ÆËã»ú·¢³öÖ¸Áî¡¢Æô¶¯Ó¦ÓóÌÐòµÈ²Ù×÷ÈÎÎñ¡£
¢ÔÚjavaÖУ¬AWTÊÇÓÃÀ´´¦ÀíͼÐÎ×î»ù±¾µÄ·½Ê½£¬Ëü¿ÉÒÔÓÃÀ´´´½¨javaµÄappletºÍ´°¿Ú¡ ......