JavaSwing图形界面编程之JSplitPane(一)

来源:互联网 发布:网络视频课件打不开 编辑:程序博客网 时间:2024/05/22 10:23


package three.day.frame;



import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JSplitPane;




public class JSplitPaneDemo01 {


public static void main(String[] args) {
        JFrame frame = new JFrame("分割式面板");
        frame.setBounds(0, 0, 200, 300);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,new JButton("1"),new JButton("2"));
        splitpane.setOneTouchExpandable(true);
        splitpane.setDividerSize(8);
        frame.add(splitpane);
        frame.setVisible(true);
        splitpane.setDividerLocation(0.5);
}
}
原创粉丝点击