javaʼþ´¦Àí»úÖÆ£¨×Ô¶¨Òåʼþ£©¡¾×ª¡¿
javaÖеÄʼþ»úÖƵIJÎÓëÕßÓÐ3ÖÖ½ÇÉ«£º
1.event object£ºÊ¼þ״̬¶ÔÏó£¬ÓÃÓÚlistenerµÄÏàÓ¦µÄ·½·¨Ö®ÖУ¬×÷Ϊ²ÎÊý£¬Ò»°ã´æÔÚÓëlisternerµÄ·½·¨Ö®ÖÐ
2.event source£º¾ßÌåµÄʼþÔ´£¬±ÈÈç˵£¬Äãµã»÷Ò»¸öbutton£¬ÄÇôbutton¾ÍÊÇevent source£¬ÒªÏëʹbutton¶ÔijЩʼþ½øÐÐÏìÓ¦£¬Äã¾ÍÐèҪע²áÌض¨µÄlistener¡£
3.event listener£º¾ßÌåµÄ¶Ô¼àÌýµÄʼþÀ࣬µ±Ëü¼àÌýµ½event object²úÉúµÄʱºò£¬Ëü¾Íµ÷ÓÃÏàÓ¦µÄ·½·¨£¬½øÐд¦Àí¡£
ÏÈ¿´¿´jdkÌṩµÄevent°ü£º
public interface EventListener£ºËùÓÐʼþÕìÌýÆ÷½Ó¿Ú±ØÐëÀ©Õ¹µÄ±ê¼Ç½Ó¿Ú¡£
public class EventObject extends Object implements Serializable
ËùÓÐʼþ״̬¶ÔÏ󶼽«´ÓÆäÅÉÉúµÄ¸ùÀà¡£ ËùÓÐ Event ÔÚ¹¹Ôìʱ¶¼ÒýÓÃÁ˶ÔÏó "source"£¬ÔÚÂß¼ÉÏÈÏΪ¸Ã¶ÔÏóÊÇ×î³õ·¢ÉúÓÐ¹Ø Event µÄ¶ÔÏó¡£
ÔÚJava2´¦Àíʼþʱ£¬Ã»ÓвÉÓÃdispatchEvent()-postEvent()-handleEvent()·½Ê½£¬²ÉÓÃÁ˼àÌýÆ÷À࣬ÿ¸öʼþÀ඼ÓÐÏà¹ØÁªµÄ¼àÌýÆ÷½Ó¿Ú¡£Ê¼þ´ÓʼþÔ´µ½¼àÌýÕߵĴ«µÝÊÇͨ¹ý¶ÔÄ¿±ê¼àÌýÕ߶ÔÏóµÄJava·½·¨µ÷ÓýøÐеġ£
¡¡¡¡¶Ôÿ¸öÃ÷È·µÄʼþµÄ·¢Éú£¬¶¼ÏàÓ¦µØ¶¨ÒåÒ»¸öÃ÷È·µÄJava·½·¨¡£ÕâЩ·½·¨¶¼¼¯Öж¨ÒåÔÚʼþ¼àÌýÕߣ¨EventListener£©½Ó¿ÚÖУ¬Õâ¸ö½Ó¿ÚÒª¼Ì³Ð java.util.EventListener¡£ ʵÏÖÁËʼþ¼àÌýÕß½Ó¿ÚÖÐһЩ»òÈ«²¿·½·¨µÄÀà¾ÍÊÇʼþ¼àÌýÕß¡£
¡¡¡¡°éËæ×ÅʼþµÄ·¢Éú£¬ÏàÓ¦µÄ״̬ͨ³£¶¼·â×°ÔÚʼþ״̬¶ÔÏóÖУ¬¸Ã¶ÔÏó±ØÐë¼Ì³Ð×Ôjava.util.EventObject¡£Ê¼þ״̬¶ÔÏó×÷Ϊµ¥²Î´«µÝ¸øÓ¦ÏìÓ¦¸ÃʼþµÄ¼àÌýÕß·½·¨ÖС£·¢³öijÖÖÌض¨Ê¼þµÄʼþÔ´µÄ±êʶÊÇ£º×ñ´Ó¹æ¶¨µÄÉè¼Æ¸ñʽΪʼþ¼àÌýÕ߶¨Òå×¢²á·½·¨£¬²¢½ÓÊܶÔÖ¸¶¨Ê¼þ¼àÌýÕß½Ó¿ÚʵÀýµÄÒýÓá£
Ê×ÏÈÎʸöÎÊÌ⣺ÄúÊìϤjava.util.EventObject ºÍjava.util.EventListenerÁ½¸öÀàÒÔ¼°ËûÃÇÒÑÓеÄ×ÓÀàÂð£¿
Èç¹ûÄãÒѾÄܹ»ÊìÁ·Ê¹ÓÃjdkΪÎÒÃÇÌṩµÄʼþ¼àÌýÆ÷£¬²¢ÇÒºÜÊìϤMouseEvent, KeyEvent, WindowEventµÈµÈÕâЩjdkΪÎÒÃÇ×¼±¸ºÃµÄʼþ£¬ÄÇôÏë±ØÄã¶ÔjavaµÄʼþ»úÖÆÒѾÓÐËùÀí½â¡£µ«ÊÇÒ²ÐíÄ㻹ÊǾõµÃËäÈ»ÓÃÆðÀ´Ã»Ê²Ã´ÎÊÌ⣬µ«ÊÇÔÀí»¹ÊÇÓÐЩºýÍ¿£¬ÄÇôÏÂÃæÎÒÃÇÔÙ½øÒ»²½×Ô¼ºÊµÏÖÕâЩʼþºÍ¼àÌýÆ÷£¬¼´×Ô¶¨Òåʼþ¡£
Æäʵ×Ô¶¨ÒåʼþÔÚjavaÖкÜÓÐÓô¦£¬ÎÒÃÇÓеÄʱºòÏëÈÃ×Ô¼ºµÄ³ÌÐò²úÉúÒ»¸öʼþ£¬µ«Óв»Ï£Íû£¨»òÕß²»¿ÉÄÜ£©ÓÃÊó±ê£¬¼üÅÌÖ®ÀàµÄÊäÈëÉ豸½øÐвÙ×÷£¬±ÈÈçÄãдһ¸öÓ¦ÓóÌÐò£¬ÔÚÕâ¸ö³ÌÐòÖÐÒ»µ©ÊÕµ½Óʼþ¾Í¶ÔÓʼþ½øÐÐÏà¹Ø´¦Àí£¬¶ÔÓÚ“ÊÕµ½Óʼþ”Õâ¸
Ïà¹ØÎĵµ£º
½ñÍíÔÚ¹äCSDNµÄʱºò·¢ÏÖÁË£¬ÓÐÈËÓÃjavaдÁËÉú³Émyeclipse×¢²áÂëµÄ´úÂ룬ËùÒԾͳ¼ÁËÏÂÀ´¡£ o(∩_∩)o ¹þ¹þ
package gggg;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class MyEclipseGen {
private static final ......
Íæ¹ýPSPµÄÅóÓÑÃÇ£¬Ïë±Ø¶¼Ìý˵¹ý¡¶ÓÂÕß30¡·µÄ´óÃû°É£¿àÅ£¬Ã»´í£¬ÎÒ˵µÄ¾ÍÊÇÄÇ¿î±ØÐëÔÚ30ÃëÄÚͨ¹ØµÄ±ä̬ÓÎÏ·¡£
´Ó±íÃæÉÏ¿´£¬¡¶ÓÂÕß30¡·µÄÓÎϷģʽÔÙ¼òµ¥²»¹ý£¬ÎÞ·ÇÊÇ´«Í³µÄRPGÓÎÏ·ÄÇÑù´ò¹Ö¡¢Á·¼¶¡¢Íê³ÉÖ§ÏßÈÎÎñ¡¢ÌáÉý×°±¸¡¢Ì½ÏÕ¡¢ÏûÃðħÍõ½áÊøÓÎÏ·¡£µ«ÊÇ£¬ËùÓÐÊܹýÆ䶾º¦µÄÅóÓѶ¼Çå³þ£¬ÕâЩҲ½ö½öÊDZíÃæÏÖÏó°ÕÁË¡£
ÒòΪÕâËù ......
import java.net.*;
import java.io.*;
public class PortScanner {
public static void main(String args[]){
String host="localhost";
new PortScanner().scan(host);
}
public void scan(String host){
  ......
1Áгö´ÅÅÌ/Îļþ¼ÐÄÚµÄÎļþ
import java.io.File;
import java.io.IOException;
public class Test {
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
&n ......
ÖØдµÄÖ÷ÒªÓŵãÊÇÄܹ»¶¨Òå×ÓÀàÌØÓеÄÌØÕ÷: Èç:
public class Father{
public void speak(){
System.out.println("Father");
}
}
public class Son extends Father{
public void speak(){
System.out.println("son");
}
}
ÕâÒ²½Ð×ö¶à̬ÐÔ,ÖØд·½·¨Ö»ÄÜ´æÔÚÓÚ¾ßÓм̳йØϵµÄÀàÖÐ,ÖØд·½·¨Ö»ÄÜÖ ......