e824. 获得和设置JSplitPane中的子组件
// 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);
Related Examples |