我知道该程序需要关闭窗口功能来关闭框架,但我不知道为什么
解释会有所帮助
public class NoLayoutDemo {
public static void main(String[] args) {
Frame frame= new Frame("no layout teset");
frame.setLayout(null);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
System.exit(0);
}
}
最佳答案
根据java文档
WINDOW_CLOSING:
If the program doesn't explicitly hide or dispose the window while processing this
event, the window close operation is canceled.
然后,您必须自己执行关闭操作,否则关闭操作无效。
希望这可以帮助
关于java - 为什么没有windowClosing有问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/59309693/