JFrame
uses a BorderLayout
by default. It’s default position (if you don’t specify one) is CENTER
.
BorderLayout
will only allow one component to occupy any of it’s 5 available positions.
So when you do…
jframe.add(scrollFrame);
jframe.add(container);
It adds the scrollFrame
to the center position and effectively removes it when you add container
(it doesn’t actually remove it, but the result is just about the same).
Try supplying a position constraint. For example…
jframe.add(scrollFrame);
jframe.add(container, BorderLayout.SOUTH);
See How to use BorderLayout for more details