• <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
            久久夜色精品国产网站| 免费精品久久久久久中文字幕| 亚洲国产精品无码久久久久久曰| 久久久久人妻精品一区二区三区| 久久夜色精品国产亚洲| 久久精品国产亚洲AV蜜臀色欲| 2020国产成人久久精品| 人妻精品久久久久中文字幕69| 国产午夜精品理论片久久影视| 久久久久国产| 无码专区久久综合久中文字幕| 久久久精品午夜免费不卡| 久久人人爽人人爽人人片AV东京热| 亚洲人AV永久一区二区三区久久| 婷婷久久香蕉五月综合加勒比| 狠狠干狠狠久久| 色综合久久中文字幕综合网| 香蕉久久夜色精品升级完成| 久久人妻少妇嫩草AV无码专区| 女同久久| 国产精品嫩草影院久久| 天天躁日日躁狠狠久久| 性做久久久久久久久久久| 97精品伊人久久久大香线蕉 | 久久久久久久综合综合狠狠| 中文国产成人精品久久不卡| 国产精品99久久不卡| 人妻无码αv中文字幕久久| 人妻丰满?V无码久久不卡| 无码人妻少妇久久中文字幕蜜桃| 一97日本道伊人久久综合影院| 亚洲狠狠综合久久| 无码人妻久久一区二区三区免费丨 | 久久笫一福利免费导航 | 久久天天躁狠狠躁夜夜2020| 97久久国产露脸精品国产| 久久综合色老色| 国内精品伊人久久久久777| 欧美日韩中文字幕久久久不卡 | 亚洲av伊人久久综合密臀性色| 久久国产免费直播|