Javaʼþ»úÖÆ
ʼþÔ´¸ºÔð²úÉúʼþ
ʼþÀࣺ¶¨ÒåʼþµÄÌØÕ÷£»
¼àÌýÆ÷½Ó¿Ú£º¶¨Òå¼àÌýÆ÷Ó¦¸ÃʵÏֵŦÄÜ£»
¼àÌýÆ÷£ºÊµÏÖ¼àÌýÆ÷½Ó¿Ú£¬¼àÌýʼþµÄ·¢Éú²¢×÷³öÏìÓ¦£»
ËùÓеÄʼþÀà±ØÐë¼Ì³ÐJavaʼþ»ùÀ࣬¼´java.util.EventObject£»EventObject(Object source)ÊÇEventObjectΨһµÄ¹¹Ôì·½·¨£¬ÕâÒâζ×ÅËùÓÐʼþ±ØÐëÔÚʵÀý»¯Ê±¾ÍÖ¸¶¨Ê¼þÔ´£»EventObjectÀàÌṩÁËgetSource()·½·¨À´»ñȡʼþÔ´£»
¶¨ÒåÁËʼþÀàºó£¬²úÉúÒ»¸öʼþ£¬¾ÍÊÇÉú³ÉʼþÀàµÄÒ»¸öʵÀý¡£
³ýÁËʼþÔ´£¬¸´ÔÓµÄʼþÀà´úÂë¿ÉÒÔº¬ÓÐÆäËûÊôÐÔ¡¢·½·¨£¬°üº¬¸ü¶àµÄÐÅÏ¢£¬ÈçʼþµÄÃû³Æ¡¢Ê¼þ·¢ÉúµÄʱ¼ä¡¢Ê¼þËùÊôÀà±ðÒÔ¼°Ê¼þµÄÃèÊöµÈµÈ
¼àÌýÆ÷½Ó¿Ú¶¨ÒåÁËÒ»¸öÀàÒª³ÉΪ¼àÌýÆ÷±ØÐë¾ß±¸µÄ¹¦ÄÜ¡£ËùÓеļàÌýÆ÷½Ó¿ÚÒ²¶¼±ØÐë¼Ì³Ð¼àÌýÆ÷½Ó¿Ú»ùÀàjava.util.EventListener£»EventListener±¾ÉíûÓж¨ÒåÈκη½·¨£¬ËüÖ»ÊÇÒ»¸ö±êÖ¾½Ó¿Ú£¬ÓÃÀ´±íÃ÷ËùÓм̳Ð×ÔEventListenerµÄ½Ó¿ÚÊôÓÚ¼àÌýÆ÷½Ó¿Ú¡£
¼àÌýÆ÷½Ó¿Ú¶¨ÒåÁ˼àÌýÆ÷±ØÐëʵÏֵķ½·¨¡£¿ÉÒÔÔÚ¼àÌýÆ÷½Ó¿ÚÖж¨ÒåÈÎÒâ¶àµÄʼþ´¦Àí·½·¨£¬È¡¾öÓÚÓ¦ÓÃËùÐ裬ʼþ´¦Àí·½·¨ÒÔʼþ¶ÔÏó×÷ΪÈë¿Ú²ÎÊý£¬°üº¬¶Ôʼþ½øÐд¦ÀíµÄ´úÂ룬·½·¨Ãû³ÆÈÎÒ⣬ÈçprocessEvent»òÕßhandleEventÖ®Àà¡£
¼àÌýÆ÷ÊǼàÌýÆ÷½Ó¿ÚµÄʵÏÖÕߣ¬Ìṩ¼àÌýÆ÷½Ó¿ÚÖж¨ÒåµÄËùÓз½·¨µÄʵÏÖ´úÂë¡£¼òµ¥ÇéÐÎÏ£¬Ò»¸ö¼àÌýÆ÷Ö»¼àÌýÒ»ÖÖÀàÐ͵Äʼþ£¬¼´ÊµÏÖÒ»ÖÖ¼àÌýÆ÷½Ó¿Ú¡£¸´ÔӵļàÌýÆ÷¿ÉÒÔʵÏÖ¶àÖÖ¼àÌýÆ÷½Ó¿Ú£¬¼àÌý¶àÖÖÀàÐ͵Äʼþ¡£ÔÚʼþ´¦Àí·½·¨´úÂëÖУ¬¼àÌýÆ÷¿ÉÒÔ´ÓÈë¿Ú²ÎÊýÖлñµÃʼþ¶ÔÏ󣬲¢Í¨¹ý¸Ã¶ÔÏó»ñµÃËùÐèµÄÐÅÏ¢£¬ÀýÈçʼþÔ´¡¢Ê¼þ·¢Éúʱ¼äµÈµÈ¡£Ê¼þÔ´ÊÇÒ»¶¨¿ÉÒÔ´Óʼþ¶ÔÏóÖÐ »ñµÃµÄ£¬ÒòΪʼþ»ùÀàEventObjectÌṩÁËgetSource()·½·¨£¬³ý´ËÒÔÍ⣬ÄÜ´Óʼþ¶ÔÏóÖлñµÃµÄÐÅÏ¢£¬È¡¾öÓÚʼþÀàµÄ¶¨Òå¡£
×÷ΪʼþÔ´µÄÀ࣬±ØÐèÂú×ãÒÔÏÂÌõ¼þ£º
ʼþÔ´±ØÐëÔÚÄÚ²¿Î¬»¤Ò»¸öÒÑ×¢²á¼àÌýÆ÷µÄÁÐ±í¡£µ±Ä³¼àÌýÆ÷×¢²áʱ£¬¸Ã¼àÌýÆ÷±»Ìí¼Óµ½ÁбíÖУ¬¶ø¼àÌýÆ÷×¢Ïúʱ£¬Ôò´ÓÁбíÖÐɾ³ý£»
ʼþÔ´±ØÐëÌṩע²á·½·¨£¬ÒÔÔÊÐí¼àÌýÆ÷×¢²áΪʼþµÄ½ÓÊÕÕߣ»
ʼþÔ´±ØÐëÌṩעÏú·½·¨£¬ÒÔÔÊÐí¼àÌýÆ÷×¢Ïú£¬Í£Ö¹¶ÔʼþµÄ½ÓÊÕ£»
ʼþÔ´±ØÐëÄܹ»ÊµÀý»¯Ê¼þÀ࣬¼´²úÉúʼþ¶ÔÏó£»
µ±Ê¼þ¶ÔÏó±»²úÉúºó£¬Ê¼þÔ´±ØÐëÏòËùÓеÄ×¢²á¼àÌýÆ÷¹ã²¥¸ÃÏûÏ¢¡£Ê¼þµÄ¹ã²¥£¬ÊÇͨ¹ýÖð¸öµ÷ÓüàÌýÆ÷ÁбíÖÐËùÓмàÌýÆ÷µÄʼþ´¦Àí·½·¨À´ÊµÏֵġ£
ÔÚJavaµÄʼþÇý¶¯Ä£Ê½ÖУ¬Ê¼þÔ´ÊÇ×Ôӵġ£¶àÊýÇé¿öÏ£¬³ÌÐòÔ±Ö»Ðè±àд¼àÌýÆ÷µÄ´úÂ룬¶ø²¢²»ÐèÒª±àдʼþÔ´´úÂë¡£
//ʼþÔ
Ïà¹ØÎĵµ£º
public class FindPrime {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int num = 100;
String s = "100ÒÔÄÚµÄËØÊý£º";
for (int i = 1; i <= num; i++) {
int count = 0;
for (int j = 1; j <= (int) Math.s ......
/**
* ÕÒ³öËÄλÊýËùÓеÄÎüѪ¹íÊý×Ö
* ÎüѪ¹íÊý×Ö£ºÎ»ÊýΪżÊýµÄÊý×Ö¿ÉÒÔÓÉÒ»¶ÔÊý×ÖÏà³Ë¶øµÃ£¬Õâ¶ÔÊý×Ö°üº¬³Ë»ýÒ»°ëµÄλÊý
* È磺1260 = 21*60
*/
public class Vampire {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String s= ......
JAVAµÄ¿çƽ̨µÄÌØÐÔÉîÊÜjava³ÌÐòÔ±ÃǵÄϲ°®,µ«ÕýÊÇÓÉÓÚËüΪÁËʵÏÖ¿çƽ̨µÄÄ¿µÄ,ʹµÃËüºÍ±¾µØ»úÆ÷µÄ¸÷ÖÖÄÚ²¿ÁªÏµ±äµÃºÜÉÙ,´ó´óÔ¼ÊøÁËËüµÄ¹¦ÄÜ,±ÈÈçÓëһЩӲ¼þÉ豸ͨÐÅ,ÍùÍùÒª»¨·ÑºÜ´óµÄ¾«Á¦È¥Éè¼ÆÁ÷³Ì±àд´úÂëÈ¥¹ÜÀíÉ豸¶Ë¿Ú,¶øÇÒÓÐһЩÉ豸³§ÉÌÌṩµÄÓ²¼þ½Ó¿ÚÒѾ¾¹ýÒ»¶¨µÄ·â×°ºÍ´¦Àí,²»ÄÜÖ±½ÓʹÓÃjava³ÌÐòͨ¹ý¶Ë¿Úº ......
repaint ¶Ô×é¼þ½øÐÐÖػ棬±ÈÈçÒ»¸öpanel£¬µ±ÄãremoveµôpanelÀïÃæµÄÒ»¸ö×é¼þʱ£¬Äã±ØÐëµ÷ÓÃrepaint·½·¨²ÅÄܶÔpanel½øÐÐÖػ棬½øÐÐˢУ¬ÄãÏëҪɾ³ýµÄ×é¼þ²ÅÄÜÔÚ½çÃæÉÏÏûʧ¡£
revalidate ¶Ô×é¼þ½øÐÐÑéÖ¤£¬±ÈÈçÒ»¸öpanel£¬µ±ÄãremoveµôpanelÀïÃæµÄÒ»¸ö×é¼þʱ£¬µ±Äãµ÷ÓÃrevalidate·½·¨ºó£¬panelµÄ²¼ ......