JavaʼþÄ£ÐÍѧϰ£¨2£©
µ±³ÌÐòµÄij¸öÄ£¿é±»µ÷ÓõÄʱ¿Ì²»È·¶¨£¬¾ÍÀàËÆÓڵȴýij¸öʼþµÄ·¢Éú¡£Õâʱ£¬¿ÉÒÔ¶¨Òå×Ô¼ºµÄʼþ½øÐÐÏàÓ¦µÄ´¦Àí¡£±ÈÈ磬µÈ´ýÓû§µÄÒ»´ÎÊäÈëµÈ¡£JavaµÄʼþÄ£ÐÍÒÀÀµÓÚίÍУ¬Í¨¹ý»Øµ÷·½·¨½øÐÐÏàÓ¦µÄʼþ´¦Àí¡£ÔÚʼþÔ´ÖУ¬»áÓÐfireXXXEvent()¾ÍÊǼ¤»îÏàÓ¦µÄʼþ£¬ÆäÖлá±éÀúʼþÔ´µÄ¼àÌýÆ÷¶ÓÁУ¬µ÷ÓÃÏàÓ¦¼àÌýÆ÷µÄʼþ´¦ÀíµÄ»Øµ÷·½·¨¡£µ±Ä³¸öʼþ·¢Éúʱ£¬Ê¼þÔ´»áµ÷ÓÃfireXXXEvent()¡£ÊµÏÖ×Ô¼ºµÄʼþʱ£¬ÐèÒª¶¨ÒåÏàÓ¦µÄʼþÀàÐÍ¡¢Ê¼þ¼àÌýÆ÷¡¢Ê¼þÔ´¡£ÕâÀï¿ÉÒÔ°ÑʼþºÍʼþÔ´¶¨ÒåΪ½Ó¿Ú£¬·½±ãÈÕºóÀ©Õ¹¡£
ÕâÀÎÒʵÏÖµÄʼþÊÇÒ»¸ö¶¨Ê±Æ÷ʼþ£¬µ±Ê±¼ä¹ýÁËÖ¸¶¨¼ä¸ô£¬´¥·¢Ê¼þ¡£Æäʵ£¬Ö»ÐèÒªÒ»¸öTimer¾Í¿ÉÒÔʵÏÖÕâ¸ö¹¦ÄÜ£¬µ«ÊµÔÚûÓÐÕÒµ½ºÃµÄÀý×Ó¡£Ê¼þÔ´ConcretEventSourceÓÐTimerÊôÐÔ£¬ÔÚÖ¸¶¨Ê±¼ä¼ä¸ôµ½´ïʱ£¬µ÷ÓÃfireTimeUp¼¤»îËùÓеÄʼþ¼àÌýÆ÷£¬´Ó¶øʵÏÖÁËʼþ´¦Àí¡£
ʼþÀà
package eventmodelstudy;
/**
* ¶¨Ê±Æ÷ʼþ£¬ÊôÐÔ¿ÉÒÔ±£´æÓÐÓõÄÐÅÏ¢£¬°üÀ¨Ê¼þÔ´
* @author Administrator
*/
public class TimerEvent {
private TimerEventSource source;//ʼþÔ´
private String time;//µ±Ç°Ê±¼ä
public TimerEvent(TimerEventSource source,String time){
this.source=source;
this.time=time;
}
public Object getSource(){
return this.source;
}
public String getTime(){
return this.time;
}
}
ʼþÔ´½Ó¿Ú
package eventmodelstudy;
/**
* ¶¨Ê±Æ÷ʼþÔ´½Ó¿Ú£¬¿ÉÒÔÌí¼Ó¡¢É¾³ý¶¨Ê±Æ÷ʼþ¼àÌýÆ÷
* @author Administrator
*/
public interface TimerEventSource {
public void addTimerListener(TimerListener tl);
public void removeTimerListener(TimerListener tl);
}
¾ßÌåʼþÔ´Àà
package eventmodelstudy;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;
import java.util.Iterator;
import java.util.Vector;
import javax.swing.Timer;
/**
* ¶¨Ê±Æ÷ʼþÔ´¾ßÌåµÄʵÏÖÀà¡£µ±Ê±¼äµ½Ê±¼¤»î¼àÌýÆ÷£¬µ÷ÓÃËùÓмàÌýÆ÷µÄ»Øµ÷·½·¨»Øµ÷·½·¨
* @author Administrator
*/
public class ConcretEventSource implements TimerEventSource{
private Timer timer;
//¼àÌýÆ÷¶ÓÁУ¬±£´æËùÓÐ×
Ïà¹ØÎĵµ£º
XMLÎļþÊÇÒ»ÖÖ¿ÉÀ©Õ¹ÐÔ±êʶÓïÑÔ,xmlÎļþµÄÖ÷ÒªÓÃ;:
×öweb¿ª·¢Ê±,¿ÉÒÔÓÃxmlÎļþÀ´×öϵͳµÄÅäÖÃ
ϵͳµÄ¼¯³É
Êý¾ÝµÄÖÐת
ÒòΪxmlÎļþÊÇ¿çƽ̨µÄ,ËùÒÔ¶ÔÓ겻ͬµÄϵͳ֮¼äµÄÊý¾ÝµÄ´«ËÍ,½»»¥¿ÉÒÔÓÃxmlÎļþÀ´ÊµÏÖ
ÏÂÃæµÄÕâ¸öÏîÄ¿Ö÷ÒªÊÇÓÃÀ´:
1,½«oracleÊý¾Ý¿âÖеÄemp±íµÄ½á¹¹¶ÁÈ¡,²¢ÇÒÉú³ÉxmlÎļþ,²¢ÇÒ½«±íÖеÄÊý¾Ýͬ ......
Java SwingÖеÄJTreeÄ£ÐÍ
2009-01-04 10:40
±¾ÎĽéÉÜJava SwingÖеÄJTreeÄ£ÐÍ£¬½éÉÜÈçºÎ´´½¨¡¢Ð޸ġ¢±éÀú£¬ÉèÖÃÊ÷¡£²Î¿¼Core Java2Ïà¹ØÕ½ڼ°ÆäÔ´´úÂë¡£
SwingÊ÷ʹÓÃÈËÃÇËùÊìϤµÄÎļþ¼ÐºÍÊ÷ҶͼÀ´ÏÔʾ·Ö²ãµÄÊý¾Ý¡£Ê÷Óɽڵã×é³É£¬½Úµã¿ÉÒÔÊÇÎļþ¼Ð£¬Ò²¿ÉÒÔÊÇÊ÷Ò¶¡£Îļþ¼Ð¿ÉÒÔÓÐ×ӽڵ㣬³ý¸ù½ÚµãÖ®ÍâµÄËùÓнڵ㶼ֻÓÐÒ»¸ö¸ ......
²»Öª²»¾õ×öÈí¼þÒѾ×öÁËÊ®Ä꣬Óгɹ¦µÄϲÔã¬Ò²ÓÐʧ°ÜµÄÍ´¿à£¬µ«×ܲ»¸Ò³Æ×Ô¼ºÊǸßÊÖ£¬ÒòΪºÍÎÒÐÄÄ¿ÖÐÕæÕýµÄ¸ßÊÖÃDZÈÆðÀ´£¬»¹²îµÄÌ«Ô¶¡£ÊÀ½çÉϲ¢Ã»ÓгÉΪ¸ßÊֵĽݾ¶£¬µ«Ò»Ð©»ù±¾ÔÔòÊÇ¿ÉÒÔ×ñѵġ£
¡¡¡¡1. ÔúʵµÄ»ù´¡¡£Êý¾Ý½á¹¹¡¢ÀëÉ¢Êýѧ¡¢±àÒëÔÀí£¬ÕâЩÊÇËùÓмÆËã»ú¿ÆѧµÄ»ù´¡£¬Èç¹û²»ÕÆÎÕËûÃÇ£¬ºÜÄÑд³ö¸ßˮƽµÄ ......
ÔÚʵ¼ÊÏîÄ¿Öиø¶¨Ò»Îļþ¼Ð£¬µÃµ½Õâ¸öÎļþ¼ÐÏÂËùÓеÄÎļþÕâÑùµÄÐèÇó²¢²»ÊǺܶ࣬¸ü¶àµÄÊDzéÕÒ»òÊÇɾ³ýijһ¾ßÌåµÄÎļþ
import java.io.File;
import java.util.ArrayList;
public class FileTest {
private static ArrayList<String> filelist = new ArrayList<String>();
public stati ......
Ò»£¬JavaÓïÑÔÖеĶÔÏóÒýÓÃ
C++ÖÐÖ¸ÕëºÍÒýÓüæÓУ¬¶øJavaÖÐûÓÐÖ¸ÕëµÄ¸ÅÄÍêÈ«ÓÃÒýÓÃÌæ´ú¡£ÈçC++ÖÐÒ»Ñù£¬ÒýÓÃÊÇÎÒÃǸø±äÁ¿µÄÒ»¸ö“±ðÃû”£¬Ò»¸ö±äÁ¿¿ÉÒÔÓжà¸ö“±ðÃû”¡£ÒýÓõÄÖµÊÇÒ»¸öÄÚ´æµØÖ·£¬ÔÚ¶ÔÏóµÄÒýÓñ»¶¨Òåʱ£¬È磺
String s; //´ËʱsֵΪ¿Õ£¬ÏµÍ³²¢Ã»ÓÐΪsËùÖ¸µÄ¶ÔÏó·ÖÅäÄÚ´æ
s = ......