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(new Dimension(400, 300));
this.setTitle("Frame1");
}
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
}
2.Ö±½ÓʵÏÖWindowListener½Ó¿Ú
//Frame1.java
import java.awt.*;
import java.awt.event.*;
public class Frame1 extends Frame implements WindowListener {
public Frame1() {
this.setSize(new Dimension(400, 300));
this.setTitle("Frame1");
this.addWindowListener(this);
}
public void windowClosing(WindowEvent windowEvent) {
System.exit(0);
}
public void windowOpened(WindowEvent windowEvent) { }
public void windowClosed(WindowEvent windowEvent) { }
public void windowIconified(WindowEvent windowEvent) { }
public void windowDeiconified(WindowEvent windowEvent) { }
public void windowActivated(WindowEvent windowEvent) { }
public void windowDeactivated(WindowEvent windowEvent) { }
}
3.Ö±½Ó¼Ì³Ð´°ÌåÊÊÅäÆ÷WindowAdapter
//Frame1.java
import java.awt.*;
import java.awt.event.*;
public class Frame1 extends WindowAdapter {
public Frame1() {
Frame f=new Frame();
f.setSize(new Dimension(400, 300));
f.setTitle("Frame1");
f.addWindowListener(this);
f.setVisible(true);
}
public static void main(St
Ïà¹ØÎĵµ£º
import java.util.Scanner;
public class Game{
void welcome(){
println("»¶ÓÀ´µ½¼ôµ¶Ê¯Í·²¼ÓÎÏ·");
}
Choice getUserChoice(){
println("ÇëÑ¡Ôñ\t[1]¼ôµ¶\t[2]ʯͷ\t[3]²¼");
Scanner sc= new Scanner(System.in);
int userCh ......
Ò»¡¢Ê²Ã´ÊÇ·´É䣺
·´ÉäµÄ¸ÅÄîÊÇÓÉSmithÔÚ1982ÄêÊ×´ÎÌá³öµÄ£¬Ö÷ÒªÊÇÖ¸³ÌÐò¿ÉÒÔ·ÃÎÊ¡¢¼ì²âºÍÐÞ¸ÄËü±¾Éí״̬»òÐÐΪµÄÒ»ÖÖÄÜÁ¦¡£ÕâÒ»¸ÅÄîµÄÌá³öºÜ¿ìÒý·¢Á˼ÆËã»ú¿ÆѧÁìÓò¹ØÓÚÓ¦Ó÷´ÉäÐÔµÄÑо¿¡£ËüÊ×Ïȱ»³ÌÐòÓïÑÔµÄÉè¼ÆÁìÓòËù²ÉÓÃ,²¢ÔÚLispºÍÃæÏò¶ÔÏó·½ÃæÈ¡µÃÁ˳ɼ¨¡£ÆäÖÐLEAD/LEAD++ ¡¢OpenC++ ¡¢MetaXaºÍOpenJavaµÈ¾ÍÊÇ»ùÓÚ·´ ......
JAVAÃæÊÔÌ⼯- -
»ù´¡ÖªÊ¶£º
1.C++»òJavaÖеÄÒì³£´¦Àí»úÖƵļòµ¥ÔÀíºÍÓ¦Óá£
µ±JAVA³ÌÐòÎ¥·´ÁËJAVAµÄÓïÒå¹æÔòʱ£¬JAVA
ÐéÄâ»ú¾Í»á½«·¢ÉúµÄ´íÎó±íʾΪһ¸öÒì³£¡£Î¥·´ÓïÒå¹æÔò°üÀ¨2ÖÖÇé¿ö¡£Ò»ÖÖÊÇJAVAÀà¿âÄÚÖõÄÓïÒå¼ì²é¡£ÀýÈçÊý×éϱêÔ½½ç,»áÒý·¢
IndexOutOfBoundsException;·ÃÎÊnullµÄ¶ÔÏóʱ»áÒý·¢NullPointerExcepti ......
LuceneÊÇÒ»¸ö»ùÓÚJavaµÄÈ«ÎÄË÷Òý¹¤¾ß°ü¡£
»ùÓÚJavaµÄÈ«ÎÄË÷ÒýÒýÇæLucene¼ò½é£º¹ØÓÚ×÷ÕߺÍLuceneµÄÀúÊ·
È«ÎļìË÷µÄʵÏÖ£ºLueneÈ«ÎÄË÷ÒýºÍÊý¾Ý¿âË÷ÒýµÄ±È½Ï
ÖÐÎÄÇзִʻúÖƼò½é£º»ùÓÚ´Ê¿âºÍ×Ô¶¯ÇзִÊËã·¨µÄ±È½Ï
¾ßÌåµÄ°²×°ºÍʹÓüò½é£ºÏµÍ³½á¹¹½éÉܺÍÑÝʾ
Hacking Lucene£º¼ò»¯µÄ²éѯ·ÖÎöÆ÷£¬É¾³ýµÄʵÏÖ£¬¶¨ÖƵÄÅÅÐò£ ......