I will try this
When you are defining the central GUI of the central area of the main GUI, you would have to define it in a JPanel. After that then you would add the JScrollPane to that JPanel.
Example
cp= getContentPane();
cp.setLayoutManager(new BorderLayout());
...
JPanel centerPane= getCenterPane();
...
cp.add(centerPane, BorderLayout.CENTER);
...
JPanel getCenterPane()
{
JPanel jp= new JPanel();
jp.setLayoutManager(new BorderLayout());
...
JScrollPane scrollingCenterPane= getScrollingCenterPane();
jp.add(scrollingCentralPane, BorderLayout.CENTER);
...
return jp;
}
JScrollPanel getScrollingCenterPane()
{
JPanel jp= new JPanel();
// define the JPanel here
JScrollPane jsp= new JScrollPane(jp);
return jsp;
}
I didn't test it but I think it should work