如何退出应用程序 [英] HowTo exit from an application
问题描述
我有一个使用awt和Swing的应用程序,使用以下代码:
public void windowClosing(WindowEvent e){
窗口窗口= e。 getWindow();
if(window.equals(this)){
setVisible(false);
dispose();
}
}
但当我关闭它时,一些资源仍然被占用,我可以提示
直到我按CTRL C.为什么?
_____
Flex
"柔性" < FL ****** @ ammsreprogrammareweb.com>在留言中写道
news:pa **************************** @ ammsreprogramm areweb.com ...我有一个使用awt和Swing的应用程序,代码如下:
public void windowClosing(WindowEvent e){
Window window = e.getWindow() ;
if(window.equals(this)){
setVisible(false);
dispose();
}
}
但当我关闭它时,一些资源仍然被占用,我可以提示
直到我按下CTRL C.为什么?
让你的程序运行的最简单方法当你关闭窗口时退出就是
使用setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- Oliver
Il Fri,2006年5月5日16:33:52 +0000,Oliver Wong ha scritto:
让你的程序退出的最简单方法关闭窗口是为了使用setDefaultCloseOperation(JFrame.EXI T_ON_CLOSE);
它是一样的,我不明白为什么,但有些东西仍然开放......
____
FleX
" Flex" < FL ****** @ ammsreprogrammareweb.com>在留言中写道
news:pa **************************** @ ammsreprogramm areweb.com ...Il Fri,2006年5月5日16:33:52 +0000,Oliver Wong ha scritto:
让你的程序退出的最简单方法关闭窗口
使用setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
它是一样的,我不明白为什么,但是还有什么东西是开着的..
你能发一个SSCCE来证明这个问题吗?
http://mindprod.com/jgloss/sscce.html
- Oliver
I have an application that use awt and Swing, with this code :
public void windowClosing(WindowEvent e) {
Window window = e.getWindow();
if (window.equals(this)) {
setVisible(false);
dispose();
}
}
But when I close it some resources remain occuped and I can have prompt
until I press CTRL C. Why ?
_____
Flex
"Flex" <fl******@ammsreprogrammareweb.com> wrote in message
news:pa****************************@ammsreprogramm areweb.com...I have an application that use awt and Swing, with this code :
public void windowClosing(WindowEvent e) {
Window window = e.getWindow();
if (window.equals(this)) {
setVisible(false);
dispose();
}
}
But when I close it some resources remain occuped and I can have prompt
until I press CTRL C. Why ?
The easiest way to get your program to quit when you close the window is to
use the setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- Oliver
Il Fri, 05 May 2006 16:33:52 +0000, Oliver Wong ha scritto:
The easiest way to get your program to quit when you close the window is to
use the setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
It''s the same, I don''t understand why, but something remains open..
____
FleX
"Flex" <fl******@ammsreprogrammareweb.com> wrote in message
news:pa****************************@ammsreprogramm areweb.com...Il Fri, 05 May 2006 16:33:52 +0000, Oliver Wong ha scritto:The easiest way to get your program to quit when you close the window is
to
use the setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
It''s the same, I don''t understand why, but something remains open..
Can you post an SSCCE demonstrating the problem?
http://mindprod.com/jgloss/sscce.html
- Oliver
这篇关于如何退出应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!