![]() |
The Java Developers Almanac 1.4 |
|
e824. Getting the Setting the Children in a JSplitPane Container // Create a left-right split pane
JSplitPane hpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftComponent, rightComponent);
// Create a top-bottom split pane
JSplitPane vpane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topComponent, bottomComponent);
// Get the children from the horizontal split pane
leftComponent = hpane.getLeftComponent();
rightComponent = hpane.getRightComponent();
// Get the children from the vertical split pane
topComponent = vpane.getTopComponent();
bottomComponent = vpane.getBottomComponent();
// Replace the children in the horizontal split pane
hpane.setLeftComponent(comp1);
hpane.setRightComponent(comp2);
// Replace the children in the vertical split pane
vpane.setTopComponent(comp3);
vpane.setBottomComponent(comp4);
e825. Distributing Space When a JSplitPane Container Is Resized e826. Getting and Setting the Divider Location in a JSplitPane Container e827. Setting the Size of the Divider in a JSplitPane Container © 2002 Addison-Wesley. |