admin 管理员组

文章数量: 1086019


2024年4月17日发(作者:如何自学编程找工作)

Java应用程序窗口关闭的六种方法

Java应用程序窗口关闭的六种方法:

1.使用JFrame的enableEvents和processWindowEvent

/ /

import .*;

import .*;

import .*;

public class Frame1 extends JFrame {

public Frame1() {

enableEvents(_EVENT_MASK);

e(new Dimension(400, 300));

le("Frame1");

}

protected void processWindowEvent(WindowEvent e) {

sWindowEvent(e);

if (() == _CLOSING) {

(0);

}

}

}

2.直接实现WindowListener接口

//

import .*;

import .*;

public class Frame1 extends Frame implements WindowListener {

public Frame1() {


本文标签: 关闭 自学 编程 接口