Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

½«Java¶ÔÏó±£´æÎªXMLÎĵµ

package com.kiloway.trace.utils;
import java.lang.reflect.Field;
/**
* @author Zhang Qi
* @Create Time 2010/01/09
* */
public class ObjectToXML {
public String toString(Object object) throws Exception {
StringBuilder sb = new StringBuilder();
//µÃµ½ÀàµÄÃû³Æ
String classname = object.getClass().getSimpleName();
//µÃµ½ÀàÓÐÄÄЩ×Ö¶Î
Field[] fields = object.getClass().getDeclaredFields();
//ÒÔ×Ö¶ÎÃû³Æ×÷Ϊ½Úµã
sb.append("<" + classname + ">\n");
for (int i = 0; i < fields.length; i++) {
sb.append("\t<" + fields[i].getName() + ">");
//ÉèÖÃ×Ö¶ÎÊôÐԵķÃÎÊȨÏÞ
fields[i].setAccessible(true);
//»ñÈ¡×Ö¶ÎÊôÐÔ
sb.append(fields[i].get(object));
sb.append("</" + fields[i].getName() + ">\n");
}
sb.append("</" + classname + ">\n");
return sb.toString();
}
}


Ïà¹ØÎĵµ£º

java ´°¿Ú¹Ø±ÕµÄÁùÖÖ·½·¨

1.ʹÓÃJFrameµÄenableEventsºÍprocessWindowEvent
//Frame1.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Frame1 extends JFrame {
  public Frame1() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    this.setSize(ne ......

javaÁ¬½ÓOracle

    »¨ÁËÁ½Ììʱ¼ä£¬ÖÕÓÚ°ÑaccessÊý¾Ý¿âÀïµÄÊý¾Ý»»µ½OracleÁË¡£µ±È»ÕâÆäÖÐÒª¸ÐлͬѧºÍ²©ÓѵÄÈÈÐİïÖúÀ­¡£ÏÖ½«½ñÌìµÄÊÕ»ñÕûÀíÏ¡£
    ÎÒÓõÄÊÇOracle 10 express edition°æ±¾£¬Õâ¸ö°æ±¾½¨Êý¾Ý¿âͦÂé·³µÄ£¬ËùÒÔÎÒ¾ÍÖ±½ÓÔÚËü×Ô´øµÄÊý¾Ý¿âXEϽ¨±íÁË¡£
    ×¢Ò⣺½¨±í¿ÉÒ»¶¨Òª ......

JavaÖ®¿É±ä²ÎÊý


public class VariableParameter {
public static void main(String[] args) {
System.out.println(add(1,2));
System.out.println(add(1,2,3,4));
}
public static int add(int x,int...args){
     //ÊÇ3¸öµã£¬args±ØÐëÊÇ ......

JavaÃØÊ·£ºÒþ²ØÔÚSWT/Swing±³ºóµÄ¹ÊÊÂ

Òë×¢
£º±¾ÎÄÀ´×Ôstraight_talking_java@yahoogroups.comÌÖÂÛ×飬ÒѾ­ÊÇÒ»Äê¶àǰ
µÄÎÄÕ¡£Alan WilliamsonÊÇJava Developers
JournalµÄ±à¼­£¬ÏÂÎÄÀ´×ÔËûÔÚIBMµÄÒ»¸öÏûÏ¢À´Ô´¡£SWTºÍSwingµÄÂÛÕùÎÒ¼û¹ý²»ÉÙ£¬NetbeansºÍEclipseµÄҲͬÑù¶à¡£ÒëÕß·­Òë
´ËÎIJ¢²»ÊÇÒª¼¤ÆðʲôÕùÖ´£¬Ò²²»ÊÇÖ§³ÖÄÄÒ»·½£¨ËäÈ»ÎÒµÄÈ·ÊÇÕ¾ÔÚSWTÒ»±ßµ ......

anic£º±ÈC¿ì±ÈJava°²È«±Èshell»¹¼òµ¥µÄÐÂÓïÑÔ

һλIDΪultimusµÄ³ÌÐòÔ±¿ª·¢ÁËÒ»ÖÖÃûΪanicµÄÐÂÓïÑÔ£¬½üÈÕÒýÆðÒµ½ç¹Ø×¢¡£¸ù¾ÝGoogle CodeÉϸÃÏîÄ¿µÄ¼ò½é£¬¸ÃÓïÑÔµÄÕýʽÃû³ÆÊÇANI£¬anicÊÇÕâÖÖÓïÑԵIJο¼ÊµÏÖ¡£
ANIÊÇÒ»ÖÖʵÑéÐÔ¡¢¸ßÐÔÄÜ¡¢¾²Ì¬°²È«¡¢ÍêÈ«Òþº¬Ö§³Ö²¢ÐС¢ÃæÏò¶ÔÏóµÄͨÓÃÊý¾ÝÁ÷±à³ÌÓïÑÔ¡£
anicÓÃGNU¹¤¾ßÁ´Ð´³É£¬Òò´Ë¿ÉÒÆÖ²ÐԺܺ㬿ÉÒÔÔËÐÐÓÚËùÓÐÖ÷Á÷²Ù×÷ϵ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ