• <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
            国产高清美女一级a毛片久久w | 99久久国产亚洲高清观看2024 | 无码超乳爆乳中文字幕久久| 久久综合精品国产一区二区三区| 久久亚洲国产精品123区| 性做久久久久久久久老女人| 久久99久国产麻精品66| 成人国内精品久久久久影院| 久久99精品国产麻豆蜜芽| 久久久久久伊人高潮影院| 日本精品久久久中文字幕| 久久午夜无码鲁丝片午夜精品| 18岁日韩内射颜射午夜久久成人| 91精品国产高清久久久久久国产嫩草 | 亚洲精品高清国产一线久久| 久久久久一区二区三区| 97精品伊人久久大香线蕉| 国产精品一久久香蕉国产线看 | 亚洲国产成人久久综合野外| 99久久久国产精品免费无卡顿| 无码乱码观看精品久久| 久久国产精品久久久| 久久人人爽人人爽人人AV东京热| 久久久精品久久久久久| 久久精品国产亚洲AV无码麻豆| 伊人久久大香线蕉AV一区二区| 国产99久久久久久免费看| 久久成人国产精品| 99久久精品免费看国产一区二区三区| 久久精品国产亚洲一区二区三区| 久久精品国产影库免费看| 国产精品久久99| AV无码久久久久不卡蜜桃| 久久亚洲精品人成综合网| 一本一本久久A久久综合精品| 午夜精品久久久久久影视riav| 国产视频久久| 久久久久久噜噜精品免费直播| 精品国产青草久久久久福利| 国产精品美女久久久久AV福利| 日韩精品国产自在久久现线拍 |