如:
public class Controller extends JFrame {
public Controller(){
this.setTitle("MVC_MontyHall");
//用户在此窗体上发起 "close" 时退出应用程序(终止该进程)
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.Init();
}
javax.swing
接口 WindowConstants
-
所有已知实现类:
- JDialog, JFrame, JInternalFrame
public interface WindowConstants
用于控制窗口关闭操作的常量。由 JFrame
、JInternalFrame
和 JDialog
提供的 setDefaultCloseOperation
和 getDefaultCloseOperation
方法使用这些常量。有关设置默认窗口操作的示例,请参阅《The Java Tutorial》中的 Responding to Window-Closing Events 一节。
-
另请参见:
-
JFrame.setDefaultCloseOperation(int)
,JDialog.setDefaultCloseOperation(int)
,JInternalFrame.setDefaultCloseOperation(int)
字段摘要 | |
---|---|
static int | DISPOSE_ON_CLOSE 移除窗口的默认窗口关闭操作。 |
static int | DO_NOTHING_ON_CLOSE 无操作默认窗口关闭操作。 |
static int | EXIT_ON_CLOSE 退出应用程序默认窗口关闭操作。 |
static int | HIDE_ON_CLOSE 隐藏窗口的默认窗口关闭操作 |