GUI autoresize problem
Hi, I have a GUI, and whenever I add in 3 panels to the frame, the middle panel would always become squished.
The frame has a borderlayout, and I attach a panel to the frame. The panel attached has a gridlayout that contains a bunch of JLabels (puzzleGrids() returns a JPanel):
frame.getContentPane().setLayOut(new BorderLayout());
frame.getContentPane().add(puzzleGrids(), BorderLayout.CENTER);
frame.setSize(500,500);
frame.setResizable(false);
If you run the GUI at this point, you'll see a bunch of JLabels nicely displayed. Then I go back to the code and I add in three more panels to the frame. They are added BorderLayout.NORTH, BorderLayout.EAST, and BorderLayout.SOUTH. Now when you run the GUI, the center panel will become squished. So the JLabels now look smaller and more rectangular. The grids for the center panel became smaller!
I've added in a feature so that the user can hide/show the three side panels at will. If the user hides all the panels, then the center panel will go back to looking normal. However, if any of the panels are visible, then the center panel will become distorted.
I would like the center panel to stay the same size at all times. So originally, it is 500x500 (look at the above code where I set the size). How do I fix this so that the center panel will stay the same size, but the frame itself becomes larger so as to accommodate the 3 side panels? I have already tried to reset the size of the frame, but that only increased the frame. The side panels stayed the same size; they did not resize to the new frame size.

