English 中文(简体)
如何发现联合框架?
原标题:How to detect the JFrame is closed?

我尝试了一个<条码>addWindowListener,并实施了<条码>windowClosing<>code>,当我用<条码>Cmd+Q闭门时,它便可操作,但当我使用<条码>时,“条码>并不被叫,我如何解决? 是否需要通过主要听众探测窗户的Cmd+Q。 关闭窗户的普通听众,无论通过近东还是顶板,还是活动<条码>、Ctrl+Alt+Delete或<条码>Cmd+Option+Esc? 感谢。

问题回答

我不肯定Macs的情况,但视窗,你从近东接过窗户;<代码>Alt-F4;如果你通过任务主管机构关闭了电灯。 如果你利用任务主管机构来杀害这一进程,那么你不会受到警惕,但我 expect期待这样做。

You have remembered to call setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); on your JFrame instance, haven t you?

there is one more method windowClosed() try overriding thing method. hope it will work for you.

You can use this osx library: com.apple.eawt.ApplicationListener

handleQuit(ApplicationEvent event)

也许会这样做。

The Information from the docs:

申请发出时,要求进行基特活动。 这一活动是在用户选择时产生的。 用户类型指挥Q,或用户控制点击Dock应用icon和选择基特时,从申请表上划出。 您可以接受或拒绝放弃这一请求。

当然,这一解决办法不会在Windows上发挥作用。 然而,我知道,没有普遍的解决办法,因此,这或许是前进的最佳途径。

象你这样的声音需要添加一些<代码>KeyListeners和一个工厂,以检测你想要的一个特定操作系统。

核对表





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签