JAVA GUI学習-JSPlitPaneスクリーンコンポーネント学習
4331 ワード
1 public class JSplitPaneKnow extends JFrame
2 {
3 JSplitPane jSplitPane;
4 JPanel jPanelRed;
5 JPanel jPanelBlue;
6
7 public JSplitPaneKnow()
8 {
9 this.setBounds(300, 100, 400, 400);
10 this.setTitle(" ");
11 this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
12
13 jPanelBlue = new JPanel();
14 jPanelRed = new JPanel();
15 // : HORIZONTAL_SPLIT, VERTICAL_SPLIT
16 jSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,jPanelBlue,jPanelRed);
17
18 jPanelBlue.setBackground(Color.BLUE);
19 jPanelRed.setBackground(Color.RED);
20
21 this.add(jSplitPane);
22
23 //
24 jSplitPane.setDividerLocation(200);
25 //
26 jSplitPane.setDividerSize(5);
27 //
28 jSplitPane.setEnabled(false);
29 }
30 public static void main(String[] args)
31 {
32 JSplitPaneKnow jSplitPaneKnow = new JSplitPaneKnow();
33 jSplitPaneKnow.setVisible(true);
34 }
35 }