Dynamically expand/shrink a JFrame
843806Jul 3 2008 — edited Jul 3 2008I am trying to create a GUI, which is built on a JFrame, and has two Panels, one at the top, and one at the bottom. What I want to be able to do programmatically is to expand the size of the frame by some set amount, and so open a space up between the two Panels, and show another component (JTable), then when finished with, close it up again.
I have laid out my JFrame, and if I manually resize it by dragging the bottom of the frame, the lower panel remains anchored on the bottom, and a gap appears in the middle. If I do this programmatically by calling setSize() on the frame with an increased Y coordinate the form resizes, but the lower panel remains where it was, adjacent to the upper panel, and the gap is at the bottom.
I have designed this in Netbeans, so the layout is all done for me.
Can somebody suggest how I can make this work, or give a suggestion for something to try.
Thanks in anticipation