confirmation before press YES to exit program in Java(在按 YES 退出 Java 程序之前确认)
问题描述
我想通过按下关闭窗口按钮并确认来关闭程序...但是当我选择否"返回我的 Jframe 时,它仍然可以帮助我退出程序???
I want to close program by pressing Close Window Button with confirmation...But when I choose "No" to back to my Jframe, it still helps me to exit the program???
推荐答案
据我了解你想要这样的东西
From what i understand you want something like this
如果您想在某个按钮上使用它,请执行与按钮类似的功能.将听众放在上面并做同样的事情.但我不确定你的问题是否正确.但是如果你想使用按钮使用 ActionListener 和 action executed 方法.
If you want to use it on some button do similiar function to button. Put listener on it and do same. But I'm not sure if I get your question right. But If you want to use button use ActionListener and action performed method.
检查问题 - Java - 关闭 JFrame 窗口时的消息
这篇关于在按 YES 退出 Java 程序之前确认的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!