久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <bdo id='2Zksl'></bdo><ul id='2Zksl'></ul>

  • <tfoot id='2Zksl'></tfoot>
    <legend id='2Zksl'><style id='2Zksl'><dir id='2Zksl'><q id='2Zksl'></q></dir></style></legend>

        <small id='2Zksl'></small><noframes id='2Zksl'>

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

        Java Swing - 如何在另一個面板上顯示一個面板?

        Java Swing - how to show a panel on top of another panel?(Java Swing - 如何在另一個面板上顯示一個面板?)
          <tbody id='KX4te'></tbody>
          <i id='KX4te'><tr id='KX4te'><dt id='KX4te'><q id='KX4te'><span id='KX4te'><b id='KX4te'><form id='KX4te'><ins id='KX4te'></ins><ul id='KX4te'></ul><sub id='KX4te'></sub></form><legend id='KX4te'></legend><bdo id='KX4te'><pre id='KX4te'><center id='KX4te'></center></pre></bdo></b><th id='KX4te'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='KX4te'><tfoot id='KX4te'></tfoot><dl id='KX4te'><fieldset id='KX4te'></fieldset></dl></div>
              <bdo id='KX4te'></bdo><ul id='KX4te'></ul>
              <legend id='KX4te'><style id='KX4te'><dir id='KX4te'><q id='KX4te'></q></dir></style></legend><tfoot id='KX4te'></tfoot>
            • <small id='KX4te'></small><noframes id='KX4te'>

                  本文介紹了Java Swing - 如何在另一個面板上顯示一個面板?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我希望有一個內部(非窗口)對話框來詢問成員輸入.我希望將對話框集中放置在現有的 JPanel 上.

                  我查看了

                  編輯

                  分層窗格不合適的原因是由于缺少每層的布局管理器.面板可調整大小,面板 A 應保持在 100% 的區域,面板 B 應保持集中.

                  解決方案

                  我認為 LayeredPane 是你最好的選擇.您將需要第三個面板來包含 A 和 B.這第三個面板將是 layeredPane,然后面板 A 和 B 仍然可以有一個不錯的 LayoutManagers.您所要做的就是使 B 居中于 A 之上,在 Swing 路徑中??有很多關于如何做到這一點的示例.不使用 LayoutManager 的定位教程.

                  公共類 Main {私有 JFrame 框架 = new JFrame();私人 JLayeredPane lpane = new JLayeredPane();私人JPanel panelBlue = new JPanel();私人JPanel panelGreen = new JPanel();公共主要(){frame.setPreferredSize(新維度(600, 400));frame.setLayout(new BorderLayout());frame.add(lpane, BorderLayout.CENTER);lpane.setBounds(0, 0, 600, 400);panelBlue.setBackground(Color.BLUE);panelBlue.setBounds(0, 0, 600, 400);panelBlue.setOpaque(true);panelGreen.setBackground(Color.GREEN);panelGreen.setBounds(200, 100, 100, 100);panelGreen.setOpaque(true);lpane.add(panelBlue, new Integer(0), 0);lpane.add(panelGreen, new Integer(1), 0);框架.pack();frame.setVisible(true);}/*** @param args 命令行參數*/公共靜態無效主要(字符串[]參數){新的主要();}}

                  您可以使用 setBounds 將面板定位在分層窗格內并設置它們的大小.

                  編輯以反映對原始帖子的更改您將需要添加組件偵聽器,以檢測何時調整父容器的大小,然后動態更改面板 A 和 B 的邊界.

                  I wish to have an internal (non window) dialog to ask for member input. I would like the dialog to be placed centrally on an existing JPanel.

                  I have looked at layeredpanes and these seem unusable due to only having a single layout manager (or no layout manager) across all the panes. I guess I could try to override JLayeredPane and provide a custom layout but this seems extreme.

                  Glass panes don't seem to be appropriate either.

                  How can this be done? Is there no usable concept of z-indexes in Swing?

                  EDIT

                  The reason Layered Panes weren't appropriate was due to the lack of a layout manager per layer. The panel is resizeable, Panel A should stay at 100% of area and Panel B should stay centralized.

                  解決方案

                  I think LayeredPane is your best bet here. You would need a third panel though to contain A and B. This third panel would be the layeredPane and then panel A and B could still have a nice LayoutManagers. All you would have to do is center B over A and there is quite a lot of examples in the Swing trail on how to do this. Tutorial for positioning without a LayoutManager.

                  public class Main {
                      private JFrame frame = new JFrame();
                      private JLayeredPane lpane = new JLayeredPane();
                      private JPanel panelBlue = new JPanel();
                      private JPanel panelGreen = new JPanel();
                      public Main()
                      {
                          frame.setPreferredSize(new Dimension(600, 400));
                          frame.setLayout(new BorderLayout());
                          frame.add(lpane, BorderLayout.CENTER);
                          lpane.setBounds(0, 0, 600, 400);
                          panelBlue.setBackground(Color.BLUE);
                          panelBlue.setBounds(0, 0, 600, 400);
                          panelBlue.setOpaque(true);
                          panelGreen.setBackground(Color.GREEN);
                          panelGreen.setBounds(200, 100, 100, 100);
                          panelGreen.setOpaque(true);
                          lpane.add(panelBlue, new Integer(0), 0);
                          lpane.add(panelGreen, new Integer(1), 0);
                          frame.pack();
                          frame.setVisible(true);
                      }
                  
                  
                      /**
                       * @param args the command line arguments
                       */
                      public static void main(String[] args) {
                          new Main();
                      }
                  
                  }
                  

                  You use setBounds to position the panels inside the layered pane and also to set their sizes.

                  Edit to reflect changes to original post You will need to add component listeners that detect when the parent container is being resized and then dynamically change the bounds of panel A and B.

                  這篇關于Java Swing - 如何在另一個面板上顯示一個面板?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數轉換為整數?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創建一個隨機打亂數字的 int 數組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠將 0xff000000 存儲為 int?)
                  <tfoot id='pnN55'></tfoot>

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

                              <tbody id='pnN55'></tbody>

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

                          • 主站蜘蛛池模板: 亚洲一区二区三区观看 | 久久亚洲国产 | 亚洲欧美一区二区三区情侣bbw | 一本一道久久a久久精品综合蜜臀 | 在线观看视频亚洲 | 天天操天天射综合网 | 国产精品二区三区在线观看 | 91久久精品视频 | 亚洲欧美日韩久久久 | 狠狠操电影 | 国产精品国产三级国产aⅴ中文 | 精品久久久久久久人人人人传媒 | 国产一区不卡在线观看 | 精品久久久久久久久久久久久久 | 成人国产精品久久 | 久久久青草婷婷精品综合日韩 | 久久久久久一区 | 免费在线成人网 | 久久一级免费视频 | 一区二区视频 | 成人av网站在线观看 | 欧美久久电影 | 一区二区三区不卡视频 | 综合精品| 蜜桃视频在线观看免费视频网站www | 美女福利视频一区 | 99re热这里只有精品视频 | 91精品中文字幕一区二区三区 | 99这里只有精品视频 | 久久久99精品免费观看 | 超碰91在线 | 国产一级片 | 亚洲国产一区二区三区 | 国产福利在线 | 91精品中文字幕一区二区三区 | 亚洲成人久久久 | 特级黄色毛片 | 国产欧美日韩一区二区三区 | 国产一级在线 | 黑人粗黑大躁护士 | 欧美成年网站 |