简体   繁体   English

在Swing Java中打开另一个框架时如何禁用根框架

[英]How to Disable root Frame when Another is Open in Swing java

I have one JFrame and in that I have 10 JLabel which will open new JFrame . 我有一个JFrame ,我有10个JLabel ,它将打开新的JFrame that JFrame is Same that will open in 10 label but how to Disable that root JFrame when the Another JFrame is open and Enable that Root JFrame when that new frame is Closed? JFrame是相同的,将在10个标签中打开,但是如何在另一个JFrame打开时禁用该根JFrame ,以及在该新框架关闭时如何启用该根JFrame Can I have your Suggestion please. 请给我我的建议。

Don't use multiple JFrames. 不要使用多个JFrame。 An application should only have a single JFrame. 一个应用程序应该只有一个JFrame。

For secondary windows you should use a modal JDialog . 对于辅助窗口,应使用modal JDialog A modal JDialog will not allow you to click on the parent JFrema until the dialog is closed. 在关闭对话框之前,模态JDialog将不允许您单击父JFrema。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM