How to prevent JFrame from closing(如何防止 JFrame 关闭)
问题描述
I have a Java GUI application from which another java GUI application is invoked using reflection and loading. It works fine the only problem faced is, on closing the JFrame
of invoked application the Main GUI
application frame also closes. How can I prevent the main application (frame) from closing??
I cannot change the defaultCloseOperation
of the invoked application, However a change to the main application can be made. Does it have any thing to do with threads??
This is my applications code that executes a target application
I am not allowed to make changes to the application being invoked.
That was a comment in reply to @JeffLaJoie just to clarify, it would not require any changes to the code of the other app., just an extra method call or two by your app. at run-time to set the close operation of the 3rd party frame.
Failing that, the best solution I can think of is to start the new frame in a separate Process
that starts a new JVM, when the user closes the other app., it and the 2nd JVM will end, while leaving the original app. on-screen.
这篇关于如何防止 JFrame 关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!