• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            逛奔的蝸牛

            我不聰明,但我會(huì)很努力

               ::  :: 新隨筆 ::  ::  :: 管理 ::

             

            import javax.swing.*;
            import java.awt.*;
            import java.awt.event.*;

            public class MultiPanel extends JPanel {
                
            private static final long serialVersionUID = 1L;
                
            private JButton           changeButton1;
                
            private JButton           changeButton2;
                
            private JButton           changeButton3;
                
            private JPanel            panel1;
                
            private JPanel            panel2;
                
            private JPanel            panel3;
                
            private JPanel            currentPanel;

                
            public MultiPanel() {
                    
            this.setLayout(new BorderLayout());

                    changeButton1 
            = new JButton(
                            
            "<html><font color=red>Red Panel</font></html>");
                    changeButton2 
            = new JButton(
                            
            "<html><font color=green>Green Panel</font></html>");
                    changeButton3 
            = new JButton(
                            
            "<html><font color=blue>Blue Panel</font></html>");
                    panel1 
            = new JPanel();
                    panel2 
            = new JPanel();
                    panel3 
            = new JPanel();

                    panel1.setBackground(Color.RED);
                    panel2.setBackground(Color.GREEN);
                    panel3.setBackground(Color.BLUE);
                    currentPanel 
            = panel1;

                    Box box 
            = Box.createHorizontalBox();
                    box.add(changeButton1);
                    box.add(changeButton2);
                    box.add(changeButton3);
                    
            this.add(box, BorderLayout.SOUTH);

                    
            this.add(currentPanel, BorderLayout.CENTER);

                    addButtonActionListener();
                }


                
            private void addButtonActionListener() {
                    changeButton1.addActionListener(
            new ActionListener() {
                        
            public void actionPerformed(ActionEvent e) {
                            currentPanel.setVisible(
            false);
                            currentPanel 
            = panel1;
                            currentPanel.setVisible(
            true);
                            add(currentPanel, BorderLayout.CENTER);
                            validate();
                        }

                    }
            );

                    changeButton2.addActionListener(
            new ActionListener() {
                        
            public void actionPerformed(ActionEvent e) {
                            currentPanel.setVisible(
            false);
                            currentPanel 
            = panel2;
                            currentPanel.setVisible(
            true);
                            add(currentPanel, BorderLayout.CENTER);
                            validate();
                        }

                    }
            );

                    changeButton3.addActionListener(
            new ActionListener() {
                        
            public void actionPerformed(ActionEvent e) {
                            currentPanel.setVisible(
            false);
                            currentPanel 
            = panel3;
                            currentPanel.setVisible(
            true);
                            add(currentPanel, BorderLayout.CENTER);
                            validate();
                        }

                    }
            );
                }


                
            private static void createAndShowGUI() {
                    JFrame frame 
            = new JFrame("Multi Panel");
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    frame.setSize(
            500600);

                    MultiPanel panel 
            = new MultiPanel();
                    frame.getContentPane().add(panel, BorderLayout.CENTER);

                    frame.setVisible(
            true);
                }


                
            /**
                 * 
            @param args
                 
            */

                
            public static void main(String[] args) {
                    SwingUtilities.invokeLater(
            new Runnable() {
                        
            public void run() {
                            MultiPanel.createAndShowGUI();
                        }

                    }
            );
                }


            }

            posted on 2008-03-22 18:35 逛奔的蝸牛 閱讀(867) 評(píng)論(0)  編輯 收藏 引用 所屬分類(lèi): Java
            久久精品国产乱子伦| 久久精品aⅴ无码中文字字幕不卡| 久久强奷乱码老熟女网站| 久久99精品久久久久久水蜜桃| 免费精品99久久国产综合精品 | 7777久久亚洲中文字幕| 久久毛片一区二区| 精品久久久久久久久免费影院| 久久男人中文字幕资源站| 欧美国产精品久久高清| 欧美日韩精品久久久久| 性高朝久久久久久久久久| 亚洲国产高清精品线久久| 亚洲午夜无码AV毛片久久| 久久午夜免费视频| 久久夜色精品国产网站| 久久久久99精品成人片欧美| 99久久精品日本一区二区免费| 国产精品久久久久久久久免费| 久久91精品久久91综合| 青青国产成人久久91网| 久久91精品综合国产首页| 亚洲国产成人精品91久久久 | 无码人妻久久一区二区三区蜜桃| 中文国产成人精品久久亚洲精品AⅤ无码精品 | 99久久国产综合精品五月天喷水 | 久久久久久噜噜精品免费直播| 九九热久久免费视频| 亚洲国产成人精品91久久久 | 国产女人aaa级久久久级| 精品久久久久久无码中文字幕| 亚洲国产精品狼友中文久久久| 亚洲中文字幕无码久久精品1| 久久久无码精品亚洲日韩蜜臀浪潮| 久久久精品午夜免费不卡| 久久综合久久性久99毛片| 亚洲av伊人久久综合密臀性色 | 精品无码久久久久久久动漫| 久久久无码精品亚洲日韩京东传媒| 国产亚洲欧美精品久久久| 天天做夜夜做久久做狠狠|