• <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>

            逛奔的蝸牛

            我不聰明,但我會很努力

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

             

            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 逛奔的蝸牛 閱讀(866) 評論(0)  編輯 收藏 引用 所屬分類: Java
            蜜桃麻豆WWW久久囤产精品| 亚洲乱码精品久久久久..| 伊人久久大香线蕉影院95| 国产农村妇女毛片精品久久| 久久精品中文字幕有码| 性做久久久久久久| 精品一久久香蕉国产线看播放| 久久久久久久女国产乱让韩| 亚洲AV无码久久精品蜜桃| 人妻无码αv中文字幕久久| 国产精品天天影视久久综合网| 精品久久久久久国产免费了| 久久精品综合一区二区三区| 久久久久av无码免费网| 97久久精品人人做人人爽| 久久婷婷五月综合色高清| 日韩十八禁一区二区久久| 国产成人综合久久综合| 一本色道久久HEZYO无码| 女同久久| 久久综合一区二区无码| 26uuu久久五月天| 国产情侣久久久久aⅴ免费| 三级三级久久三级久久| 久久亚洲AV永久无码精品| 一本大道加勒比久久综合| 久久超乳爆乳中文字幕| 久久婷婷五月综合97色直播| 性欧美大战久久久久久久| 久久e热在这里只有国产中文精品99| 亚洲色欲久久久综合网| 欧美麻豆久久久久久中文| 日本精品久久久中文字幕| 久久ww精品w免费人成| 精品久久久久久中文字幕人妻最新| 久久亚洲AV无码西西人体| 久久精品成人免费国产片小草| 91久久香蕉国产熟女线看| 久久国产乱子精品免费女| 97精品伊人久久久大香线蕉| 91精品国产91久久久久久|