Java: JSplitPane

Description. JSplitPane is used to split an area into exactly two sections, vertically or horizontally, allowing the user to drag the divider between the two sections to resize them. Typically each section of a JSplitPane will contain another container (eg, JPanel, JSplitPane, ...).

Multiple splits. To create multiple splits, nest one JSplitPane inside either side of another.

Common constructors and methods

JSplitPane
sp = JSplitPane(orientation, leftOrTop, rightOrBottom);
sp = JSplitPane(orientation, continuous, leftOrTop, rightOrBottom);
 
sp.setDividerLocation(proportion);
sp.setDividerLocation(pixels);
sp
JSplitPane sp;
orientation
JSplitPane.HORZONTAL_SPLIT or JSplitPane.VERTICAL_SPLIT
leftOrTop
This component/continer is placed in the top or left pane, depending on the orientation.
rightOrBottom
Component placed in bottom or right pane, depending on the orientation.
continuous
A boolean variable. If true, as the user moves the divider, the panes are continuously redrawn. If false, redrawing tekes place once when the user releases the divider.

Avoid continuous redrawing when it's time-consuming, but expensive redrawing of components is probably the exception. To be on the safe side, continuous redrawing is false of default. The most common usage would probably be to use the constructor where continuous is true.

proportion
If you wish to control the relative position of the divider from the left/top, use a double proportion in the range 0.0 to 1.0.
Note: Setting the divider position takes effect only if the JSplitPane is already displayed, otherwise it is ignored. Therefore the setDividerLocation method should not be called during initialization.
pixels
Sets the width/height of the left/top pane to the int pixels. See note above.

Example

TO BE DONE.