• <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 逛奔的蝸牛 閱讀(869) 評(píng)論(0)  編輯 收藏 引用 所屬分類: Java
            久久se精品一区二区影院| 久久久久国产一区二区| 国内精品久久久久久99蜜桃| 久久久久久午夜成人影院| 久久99毛片免费观看不卡| 久久精品国产第一区二区| 久久久久久曰本AV免费免费| 蜜桃麻豆www久久| 久久久久精品国产亚洲AV无码| 久久国产精品-国产精品| 久久受www免费人成_看片中文| 久久久无码精品亚洲日韩按摩 | 久久精品国产影库免费看 | 久久精品国产色蜜蜜麻豆| 久久天天躁夜夜躁狠狠| 99精品伊人久久久大香线蕉| 综合久久久久久中文字幕亚洲国产国产综合一区首 | 国产精品禁18久久久夂久| 欧美成a人片免费看久久| 久久国产乱子伦免费精品| 日本精品久久久久影院日本| 国产精品久久久久9999| 欧美熟妇另类久久久久久不卡| 亚洲精品国产第一综合99久久 | 亚洲人成网站999久久久综合| 国产精品久久波多野结衣| 色欲综合久久中文字幕网| 亚洲精品99久久久久中文字幕| 国内精品久久久久久久coent| av国内精品久久久久影院| 亚洲AV无码久久精品成人 | 久久久久这里只有精品| 欧美激情精品久久久久| .精品久久久麻豆国产精品| 嫩草伊人久久精品少妇AV| 无码精品久久久久久人妻中字| 精品熟女少妇AV免费久久| 国内精品综合久久久40p| 久久亚洲AV成人无码软件| 精品久久人人爽天天玩人人妻| 中文字幕无码免费久久|