exit.java

来自「窗口的退出方法.rar」· Java 代码 · 共 102 行

JAVA
102
字号
import java.awt.event.WindowListener;
import java.util.EventListener;
import javax.swing.*;
/**
 * AWT Sample application
 *
 * @author 
 * @version 1.00 04/11/02
 */
public class Exit extends JFrame implements WindowListener{
	public Exit(){
		this.setSize(300,150);
		this.addWindowListener(this);
	}
    
    public static void main(String[] args) {
        // Create application frame.
        Exit frame = new Exit();
        
        // Show frame
        frame.setVisible(true);
    }

	/**
	 * Method windowOpened
	 *
	 *
	 * @param e
	 *
	 */
	public void windowOpened(WindowEvent e) {
		// TODO: Add your code here
	}

	/**
	 * Method windowClosing
	 *
	 *
	 * @param e
	 *
	 */
	public void windowClosing(WindowEvent e) {
		System.exit(0);
		// TODO: Add your code here
	}

	/**
	 * Method windowClosed
	 *
	 *
	 * @param e
	 *
	 */
	public void windowClosed(WindowEvent e) {
		// TODO: Add your code here
	}

	/**
	 * Method windowIconified
	 *
	 *
	 * @param e
	 *
	 */
	public void windowIconified(WindowEvent e) {
		// TODO: Add your code here
	}

	/**
	 * Method windowDeiconified
	 *
	 *
	 * @param e
	 *
	 */
	public void windowDeiconified(WindowEvent e) {
		// TODO: Add your code here
	}

	/**
	 * Method windowActivated
	 *
	 *
	 * @param e
	 *
	 */
	public void windowActivated(WindowEvent e) {
		// TODO: Add your code here
	}

	/**
	 * Method windowDeactivated
	 *
	 *
	 * @param e
	 *
	 */
	public void windowDeactivated(WindowEvent e) {
		// TODO: Add your code here
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?