• <bdo id='s4sEf'></bdo><ul id='s4sEf'></ul>
    1. <small id='s4sEf'></small><noframes id='s4sEf'>

      <i id='s4sEf'><tr id='s4sEf'><dt id='s4sEf'><q id='s4sEf'><span id='s4sEf'><b id='s4sEf'><form id='s4sEf'><ins id='s4sEf'></ins><ul id='s4sEf'></ul><sub id='s4sEf'></sub></form><legend id='s4sEf'></legend><bdo id='s4sEf'><pre id='s4sEf'><center id='s4sEf'></center></pre></bdo></b><th id='s4sEf'></th></span></q></dt></tr></i><div id='s4sEf'><tfoot id='s4sEf'></tfoot><dl id='s4sEf'><fieldset id='s4sEf'></fieldset></dl></div>
      <legend id='s4sEf'><style id='s4sEf'><dir id='s4sEf'><q id='s4sEf'></q></dir></style></legend>
      <tfoot id='s4sEf'></tfoot>

      如何在 Swing java 中制作 JFrame 模态

      How to make a JFrame Modal in Swing java(如何在 Swing java 中制作 JFrame 模态)

      <small id='0poiF'></small><noframes id='0poiF'>

            <bdo id='0poiF'></bdo><ul id='0poiF'></ul>

            1. <i id='0poiF'><tr id='0poiF'><dt id='0poiF'><q id='0poiF'><span id='0poiF'><b id='0poiF'><form id='0poiF'><ins id='0poiF'></ins><ul id='0poiF'></ul><sub id='0poiF'></sub></form><legend id='0poiF'></legend><bdo id='0poiF'><pre id='0poiF'><center id='0poiF'></center></pre></bdo></b><th id='0poiF'></th></span></q></dt></tr></i><div id='0poiF'><tfoot id='0poiF'></tfoot><dl id='0poiF'><fieldset id='0poiF'></fieldset></dl></div>
              • <legend id='0poiF'><style id='0poiF'><dir id='0poiF'><q id='0poiF'></q></dir></style></legend>
                <tfoot id='0poiF'></tfoot>
                  <tbody id='0poiF'></tbody>
                本文介绍了如何在 Swing java 中制作 JFrame 模态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我创建了一个使用 JFrame 的 GUI.我应该如何使它成为模态的?

                I have created one GUI in which I have used a JFrame. How should I make it Modal?

                推荐答案

                如果你想使窗口模式化,最好的办法是使用 JDialog 而不是 JFrame.查看在 Java 6 中引入 Modality API 的详细信息信息.还有教程.

                Your best bet is to use a JDialog instead of a JFrame if you want to make the window modal. Check out details on the introduction of the Modality API in Java 6 for info. There is also a tutorial.

                这里是一些示例代码,它将在 JDialog 中显示 JPanel 面板,它是 Frame parentFrame 的模态.除了构造函数之外,这遵循与打开 JFrame 相同的模式.

                Here is some sample code which will display a JPanel panel in a JDialog which is modal to Frame parentFrame. Except for the constructor, this follows the same pattern as opening a JFrame.

                final JDialog frame = new JDialog(parentFrame, frameTitle, true);
                frame.getContentPane().add(panel);
                frame.pack();
                frame.setVisible(true);
                

                更新 Modality API 链接 &添加了教程链接(向@spork 致敬).

                updated Modality API link & added tutorial link (nod to @spork for the bump).

                这篇关于如何在 Swing java 中制作 JFrame 模态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)
                <i id='MEFR6'><tr id='MEFR6'><dt id='MEFR6'><q id='MEFR6'><span id='MEFR6'><b id='MEFR6'><form id='MEFR6'><ins id='MEFR6'></ins><ul id='MEFR6'></ul><sub id='MEFR6'></sub></form><legend id='MEFR6'></legend><bdo id='MEFR6'><pre id='MEFR6'><center id='MEFR6'></center></pre></bdo></b><th id='MEFR6'></th></span></q></dt></tr></i><div id='MEFR6'><tfoot id='MEFR6'></tfoot><dl id='MEFR6'><fieldset id='MEFR6'></fieldset></dl></div>
                <legend id='MEFR6'><style id='MEFR6'><dir id='MEFR6'><q id='MEFR6'></q></dir></style></legend>

                <tfoot id='MEFR6'></tfoot>

                        <tbody id='MEFR6'></tbody>

                        <small id='MEFR6'></small><noframes id='MEFR6'>

                        • <bdo id='MEFR6'></bdo><ul id='MEFR6'></ul>