62,614
社区成员
发帖
与我相关
我的任务
分享
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class SplitPaneFrame extends JFrame
{
private JButton btnLeft = new JButton("左边");
private JButton btnRightTop = new JButton("右上");
private JButton btnRightBottom = new JButton("右下");
public SplitPaneFrame()
{
JSplitPane rightPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
btnRightTop,
btnRightBottom);
JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
btnLeft,
rightPane);
add(pane);
}
public static void main(String[] args)
{
JFrame frame = new SplitPaneFrame();
frame.setVisible(true);
frame.pack();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
inner=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JLabel("a"), new JLabel("b"));
outer=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, inner, new JLabel("c"));
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JSplitPane;
public class MainFrame extends JFrame {
public MainFrame() {
JSplitPane jsp1 = new JSplitPane();
jsp1.setLeftComponent(new JLabel("第一个JSplitPane的左边"));
JSplitPane jsp2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
jsp2.setLeftComponent(new JLabel("第二个JSplitPane的上边"));
jsp2.setRightComponent(new JLabel("第二个JSplitPane的下边"));
jsp1.setRightComponent(jsp2);
this.add(jsp1);
this.setTitle("JSplitPane示例");
this.setSize(800, 600);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args) {
new MainFrame();
}
}
JSplitPane jp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT ,new JLabel("上"),new JLabel("下"));
JSplitPane tpsplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT,jp ,new JLabel("右")) ;