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

  • <legend id='em8eg'><style id='em8eg'><dir id='em8eg'><q id='em8eg'></q></dir></style></legend>

    1. <tfoot id='em8eg'></tfoot>
    2. <small id='em8eg'></small><noframes id='em8eg'>

          <bdo id='em8eg'></bdo><ul id='em8eg'></ul>

        将 JPanel 变成 JOptionPane.OK_OPTION

        时间:2023-09-30
        <i id='h5sqz'><tr id='h5sqz'><dt id='h5sqz'><q id='h5sqz'><span id='h5sqz'><b id='h5sqz'><form id='h5sqz'><ins id='h5sqz'></ins><ul id='h5sqz'></ul><sub id='h5sqz'></sub></form><legend id='h5sqz'></legend><bdo id='h5sqz'><pre id='h5sqz'><center id='h5sqz'></center></pre></bdo></b><th id='h5sqz'></th></span></q></dt></tr></i><div id='h5sqz'><tfoot id='h5sqz'></tfoot><dl id='h5sqz'><fieldset id='h5sqz'></fieldset></dl></div>

            <tbody id='h5sqz'></tbody>
          • <bdo id='h5sqz'></bdo><ul id='h5sqz'></ul>
            <tfoot id='h5sqz'></tfoot>
                1. <small id='h5sqz'></small><noframes id='h5sqz'>

                  <legend id='h5sqz'><style id='h5sqz'><dir id='h5sqz'><q id='h5sqz'></q></dir></style></legend>
                  本文介绍了将 JPanel 变成 JOptionPane.OK_OPTION的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  目前我有一个扩展 JPanel 的类,基本上显示了有关传递给其构造函数的对象的一些信息.屏幕上有各种标签和图像图标,并设置了 BorderLayout.

                  currently i have a class which extends JPanel and basically shows some information about an object passed into its constructor. There are various labels and Image icons on the screen and has a BorderLayout set.

                  当用户在主 GUI 中左键单击 ImageIcon 并显示在屏幕上时,将触发此面板.

                  This panel is triggered when the user left clicks on an ImageIcon from the main GUI and shows up on the screen.

                  我想知道,我如何(如果有办法)将 JOptionPane.OK_OPTION 实现到整个面板上,这样我就不必使用事件处理关闭面板,因为屏幕只是显示信息以及何时用户已完成,他们按 OK,面板应关闭.

                  i was wondering, how (if there is a way) i could implement the JOptionPane.OK_OPTION onto the whole Panel so that i dont have to close the panel using Event handling, as the screen is simply to show information and when the user has finished, they press okay and the panel should close off.

                  谢谢约旦

                  推荐答案

                  您可以简单地在 JOptionPane 中传递该 JPanel 的对象.例如:

                  You can simply pass the object of that JPanel within the JOptionPane. For example:

                   JPanel panel = new JPanel();
                   panel.add(new JButton("Click"));
                   panel.add(new JTextField(20));
                   panel.add(new JLabel("Label"));
                   JOptionPane.showMessageDialog(null,panel,"Information",JOptionPane.INFORMATION_MESSAGE);
                  

                  上面的代码将把 JPanel 放在 JOptionPane 消息对话框上.当您单击 OK 时,面板将关闭.

                  Above code will put the JPanel on JOptionPane message dialog. When you click OK the panel closes Off.

                  这篇关于将 JPanel 变成 JOptionPane.OK_OPTION的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:JScrollPane 的滚动事件 下一篇:java swing应用程序中如何保留和删除多个图形对象

                  相关文章

                  最新文章

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

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