1. <tfoot id='4K6uL'></tfoot>

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

      <legend id='4K6uL'><style id='4K6uL'><dir id='4K6uL'><q id='4K6uL'></q></dir></style></legend>
    2. <small id='4K6uL'></small><noframes id='4K6uL'>

      如何制作模态 JFrame?

      How to make a modal JFrame?(如何制作模态 JFrame?)
    3. <small id='2IfK3'></small><noframes id='2IfK3'>

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

        1. <tfoot id='2IfK3'></tfoot>
            <bdo id='2IfK3'></bdo><ul id='2IfK3'></ul>

                本文介绍了如何制作模态 JFrame?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                可能重复:
                如何在 Swing java 中制作 JFrame Modal

                我有 2 个 JFrame,一个是主 JFrame,另一个是子 JFrame,当我显示子 JFrame 时,我试图让用户交互无法访问主 JFrame.

                I have 2 JFrames one is the main JFrame and the other one is a sub JFrame, and I'm trying to make the main JFrame inaccessible to user interactions when I display the sub JFrame.

                推荐答案

                如何制作模态JFrame?

                How to make a modal JFrame?

                不要.使用模态 JDialog——这正是它们的用途.您当然明白 JDialog 可以拥有一个复杂的 GUI,就像 JFrame 拥有的任何 GUI 一样复杂.

                Don't. Use a modal JDialog -- that's precisely what they're for. You understand of course that a JDialog can hold a complex GUI, as complex as any held by a JFrame.

                我们经常遇到使用诸如 NetBeans 之类的 GUI 构建器来帮助他们创建 GUI 的人发布的此类帖子,并且由于构建器创建了第二个窗口的代码来扩展 JFrame,因此程序员很难返回并将其更改为对话框.解决此问题的方法是尝试将 Swing 代码创建转向创建 JPanel,而不是 JFrame 等顶级窗口.这样,如果需要,您可以在 JFrame 中使用创建的 JPanel,如果需要,可以使用 JDialog,JApplet,甚至另一个 JPanel,只要最适合这种情况.这将极大地提高您代码的灵活性.

                We often run into posts like these by folks who use a GUI-builder such as NetBeans to help them create their GUI's, and since the second window's code was created by the builder to extend a JFrame, it's very hard for the programmer to go back and change it to a dialog. The way to fix this is to try to gear your Swing code creation towards creation of JPanels, not top-level windows such as JFrames. This way you could use the created JPanel in a JFrame if desired, a JDialog if desired, a JApplet, or even another JPanel, whatever works best for the situation. This will increase your code's flexibility tremendously.

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

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

                相关文档推荐

                Compiling C++ for the JVM(为 JVM 编译 C++)
                Compile to java bytecode (without using Java)(编译成java字节码(不使用Java))
                How to drive C#, C++ or Java compiler to compute 1+2+3+...+1000 at compile time?(如何在编译时驱动 C#、C++ 或 Java 编译器计算 1+2+3+...+1000?)
                Java ClassLoader: load same class twice(Java ClassLoader:两次加载相同的类)
                How to debug .class files in ECLIPSE?(如何在 ECLIPSE 中调试 .class 文件?)
                Java quot;The blank final field may not have been initializedquot; Anonymous Interface vs Lambda Expression(Java“可能尚未初始化空白的最终字段匿名接口与 Lambda 表达式)
              • <small id='5NmnA'></small><noframes id='5NmnA'>

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

                          <tbody id='5NmnA'></tbody>