I'd just made a layout in GridBagLayout for a split pane. Worked perfectly and looked right.
I then needed to then add a scroll bar vertically only. Hence I have done that now. However the layout doesn't 'size' like before. It now stretches across rather sticking to the area of the pane shown.
JSplitPane VPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,(new class1()),new JScrollPane(new class2(),ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
I need to make it look like it did before. Any ideas?
All you've done is "hide" the horizontal scroll bar. This will have no effect on the view port that is managing your component.
Try wrapping your existing layout in a
Scrollable
interface. If you don't want to implement one your self, you could use a wrapper container instead...Then, we you add it to your scroll pane...