JSplitPane クラス
- [内容]
- 領域を,縦,または,横に,大きさが可変な領域に分割するためのクラスです
- [主な変数]
- public static final int HORIZONTAL_SPLIT
- 縦に(左右の領域に)分割
- public static final int VERTICAL_SPLIT
- 横に(上下の領域に)分割
- [コンストラクタ]
- public JSplitPane()
- public JSplitPane(int newOrientation)
- public JSplitPane(int newOrientation, boolean newContinuousLayout)
- public JSplitPane(int newOrientation, boolean newContinuousLayout, Component newLeftComponent, Component newRightComponent)
- public JSplitPane(int newOrientation, Component newLeftComponent, Component newRightComponent)
- JSplitPane オブジェクトを生成する.newOrientation は,JSplitPane.HORIZONTAL_SPLIT,または,JSplitPane.VERTICAL_SPLIT から選択し,指定しないと左右分割となる.newContinuousLayout は,境界を移動させたとき連続的に描画するか,または,境界の移動を止めたとき描画するかを示し,デフォルトは false である.2 つのコンポーメントを指定しないと,各領域には JButton オブジェクトが配置される.
- [主なメソッド]
- public void paint(Graphics g) ( JComponent から継承)
- コンポーネントを描画
- public void paintAll(Graphics g) ( Component から継承)
- このコンポーネントおよびそのすべてのサブコンポーネントを描画
- public void paintComponent(Graphics g) ( JComponent から継承)
- コンポーネントを描画
- public void paintComponents(Graphics g) ( Container から継承)
- コンテナ内の各コンポーネントを描画
- public void repaint() ( Component から継承)
- public void repaint(int x, int y, int width, int height) ( Component から継承)
- public void repaint(long tm) ( Component から継承)
- public void repaint(Rectangle r) ( JComponent から継承)
- public void repaint(long tm, int x, int y, int width, int height) ( JComponent から継承)
- 指定された矩形領域を,tm ミリ秒以内に再描画する
- public void setBottomComponent ( Component comp )
- コンポーネントを境界の下(右)に設定する
- public void setContinuousLayout ( boolean newContinuousLayout )
- 境界を移動させたとき連続的に描画するか,または,境界の移動を止めたとき描画するかを指定する
- public void setDividerLocation ( double proportionalLocation )
- public void setDividerLocation ( int location)
- 境界の位置を設定する
- public void setLeftComponent ( Component comp )
- コンポーネントを境界の左(上)に設定する
- public void setOneTouchExpandable ( boolean newValue )
- 片方の領域をワンタッチで拡張できるアイコンを表示するか否かを設定する
- public void setOrientation ( int orientation )
- 分割方向を設定する
- public void setRightComponent ( Component comp )
- コンポーネントを境界の右(下)に設定する
- public void setTopComponent ( Component comp )
- コンポーネントを境界の上(左)に設定する
- [使用例]
- プログラム例は,JSplitPane クラスの各メソッド等の使用例です.左側に表示されている花の名前をクリックすると,右側にその花が表示されると共に,下のテキストエリアにメッセージが表示されます.また,花の名前を表示した領域を広げ,右側の領域を見えなくすることも可能です.

- [参照]
- JTabbedPane, BoxLayout, GridBagLayout, GridLayout, CardLayout, FlowLayout, BorderLayout