If you want both halves of the split pane to share in the split pane’s extra or removed space, set the resize weight to 0.5: (Tutorial)
JSplitPane mainSplittedPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, upperPanel,bottomPanel);
mainSplittedPane.setOneTouchExpandable(true);
mainSplittedPane.setResizeWeight(0.5);