打开新的JFrame时禁用JFrame [英] Disable JFrame when a new JFrame is opened

查看:95
本文介绍了打开新的JFrame时禁用JFrame的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在弹出新框架时禁用主要" JFrame.我想要它,所以您不能在该框架上单击或拖动任何东西.我尝试将新框架设为JDialog,但这并没有禁用其他框架.我还查看了有关此内容的另一篇文章,该文章建议将其设置为JDialog,但仍然无法正常工作.我真的需要帮助.谢谢.这是我用来制作JDialog的代码,他们有什么问题吗?

I am trying to disable the "main" JFrame when the new frame pops up. I want it so you can not click or drag anything on that frame. I tried making the new frame a JDialog, but that did not disable the other frame. I also looked at the other post about this, which suggested to make it a JDialog but it still does not work. I really need help doing this please. thanks. This is the codeIi am using to make the JDialog, is their any problems with it?

editDialog=new JDialog(IntroScreen.frame);

IntroScreen.frame代表主"框架.

推荐答案

您已设置JDialog#ModalityTypes ,也许使用

You have set for JDialog#setModal or JDialog#ModalityTypes, maybe with Dialog.ModalityType APPLICATION_MODAL

这篇关于打开新的JFrame时禁用JFrame的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆