RT
用java怎么实现 它用的list一类的组件 一次显示一列??还有一个问题:qq好友面板切换时 有种慢进慢出的感觉 也就所谓的平滑 java里又该怎么做?
       

解决方案 »

  1.   

    在PB里容易实现,在swing里边有点难。
      

  2.   

    qq2009用过没?
    当在 好友 群和最近联系 之间切换时 你没发觉它们之间是连在一起的 有中转动的感觉 不象tab那样僵硬的更换页面??
      

  3.   

    呵呵  ,这个   功能  swing
    没 见到 过 
      

  4.   

    有人先前问过这个问题,LZ要多用搜索哦:
    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;public class TestDrawer extends JFrame implements ActionListener {    private static final long serialVersionUID = 1L;    public JButton btn1 = new JButton("TestBTN1");    public JButton btn2 = new JButton("TestBTN2");    public JButton btn3 = new JButton("TestBTN3");    public JLabel lab1 = new JLabel("TestLab1");    public JLabel lab2 = new JLabel("TestLab2");    public JLabel lab3 = new JLabel("TestLab3");    public JPanel panel = new JPanel();    public TestDrawer() {
            init();
        }    private void init() {
            this.setTitle("TestDrawer");
            this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            this.getContentPane().setLayout(new BorderLayout());
            this.getContentPane().add(getCenterPanel(), BorderLayout.CENTER);
            this.pack();
            this.setVisible(true);
        }    private JPanel getCenterPanel() {
            panel.setLayout(new GridLayout(3, 1));
            panel.add(btn1);
            panel.add(btn2);
            panel.add(btn3);
            btn1.addActionListener(this);
            btn2.addActionListener(this);
            btn3.addActionListener(this);
            return panel;
        }    public void actionPerformed(ActionEvent e) {
            if (e.getSource().equals(btn1)) {
                panel.setLayout(new GridLayout(4, 1));
                panel.removeAll();
                panel.add(btn1);
                panel.add(lab1);
                panel.add(btn2);
                panel.add(btn3);
                panel.validate();
                panel.repaint();
            }
            else if (e.getSource().equals(btn2)) {
                panel.setLayout(new GridLayout(4, 1));
                panel.removeAll();
                panel.add(btn1);            
                panel.add(btn2);
                panel.add(lab2);
                panel.add(btn3);
                panel.validate();
                panel.repaint();
            }
            else if (e.getSource().equals(btn3)) {
                panel.setLayout(new GridLayout(4, 1));
                panel.removeAll();
                panel.add(btn1);
                panel.add(btn2);
                panel.add(btn3);
                panel.add(lab3);
                panel.validate();
                panel.repaint();
            }
        }    /**
         * @param args
         */
        public static void main(String[] args) {
         System.out.println("模仿QQ的竖向选项卡功能。");
            new TestDrawer();
        }
    }