<tfoot id='mCxjb'></tfoot>

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

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

        将 JPanel 变成 JOptionPane.OK_OPTION

        时间:2023-06-28

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

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

                  <tbody id='KlKVg'></tbody>
                1. 本文介绍了将 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文章

                2. <tfoot id='2V7qP'></tfoot>
                  1. <legend id='2V7qP'><style id='2V7qP'><dir id='2V7qP'><q id='2V7qP'></q></dir></style></legend>

                  2. <small id='2V7qP'></small><noframes id='2V7qP'>

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