Java JSplitPane_1

Java JSplitPane_1

package com.han;

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JSplitPane;

public class JSplitPane_1 extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3418853823231348095L;

	public JSplitPane_1() {
		// TODO Auto-generated constructor stub
		setTitle("分割面板");
		setBounds(100, 100, 500, 375);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		JSplitPane hSplitPane = new JSplitPane();
		hSplitPane.setDividerLocation(40);
		getContentPane().add(hSplitPane, BorderLayout.CENTER);
		hSplitPane.setLeftComponent(new JLabel("    1"));
		
		JSplitPane vSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
		vSplitPane.setLeftComponent(new JLabel("    2"));
		vSplitPane.setRightComponent(new JLabel("    3"));
		vSplitPane.setDividerLocation(30);
		vSplitPane.setDividerSize(8);
		vSplitPane.setOneTouchExpandable(true);
		vSplitPane.setContinuousLayout(true);
		hSplitPane.setRightComponent(vSplitPane);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		JSplitPane_1 instance = new JSplitPane_1();
		instance.setVisible(true);
	}

}


你可能感兴趣的:(split)