• <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 逛奔的蝸牛 閱讀(861) 評論(0)  編輯 收藏 引用 所屬分類: Java
            久久综合综合久久综合| 久久综合狠狠色综合伊人| 一级女性全黄久久生活片免费| 免费精品国产日韩热久久| 久久久久久久久久久久久久| 久久婷婷五月综合色奶水99啪| 91超碰碰碰碰久久久久久综合| 日韩一区二区三区视频久久| 亚洲精品无码专区久久久| 国产成人精品久久二区二区| 色婷婷狠狠久久综合五月| 久久久久亚洲精品无码蜜桃 | 久久精品一区二区三区不卡| 精品多毛少妇人妻AV免费久久| 中文字幕久久精品无码| 大美女久久久久久j久久| 久久精品国产精品亚洲精品 | 久久人人爽人人人人爽AV| 久久久久久a亚洲欧洲aⅴ| 亚洲国产成人精品女人久久久 | 国产偷久久久精品专区| 精品视频久久久久| 国产精品久久久久…| 久久综合亚洲色HEZYO社区| 99久久综合国产精品二区| 久久久久无码精品国产| 久久精品极品盛宴观看| 久久久久久噜噜精品免费直播| 国产精品久久亚洲不卡动漫| 狼狼综合久久久久综合网| 久久久久人妻一区二区三区 | 亚洲国产精品久久久久| 精品国产乱码久久久久久郑州公司 | 久久久精品人妻一区二区三区蜜桃 | 丰满少妇人妻久久久久久4| 久久超碰97人人做人人爱| 亚洲AV无码一区东京热久久 | 精品久久久久成人码免费动漫 | 久久久久婷婷| 久久国产三级无码一区二区| 久久综合久久综合九色|