I have a typical IDE style window with a top JMenuBar and JToolBar, a large center console and a bottom status bar.
Here are the main parts of the code:
mainPanel = new JPanel();
mainPanel.setLayout(new BorderLayout());
JPanel topPanel = new JPanel();
. (JMenuBar and JToolBar)
.
mainPanel.add(topPanel, BorderLayout.NORTH);
cardPanel = new JPanel();
cardPanel.setLayout(cardLayout);
.
.
Dimension minDimension = new Dimension(680, 400);
Dimension maxDimension = new Dimension(750, 800);
JPanel centerPanel = new JPanel();
centerPanel.setMinimumSize(minDimension);
centerPanel.setPreferredSize(minDimension);
centerPanel.setMaximumSize(maxDimension);
centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.Y_AXIS));
centerPanel.add(cardPanel);
mainPanel.add(centerPanel, BorderLayout.CENTER);
mainPanel.add(statusBar, BorderLayout.SOUTH);
I want to be able to control the sizing of the whole window, with a minimum and maximum size.
I thought I could have the 'centerPanel' JPanel as a BoxLayout, so I could have some control over it, but as it is, I can't control the sizing of the window at all.
I tried to make the 'mainPanel' use a BoxLayout, instead of a BorderLayout, but there where too many issues.
Is the main BorderLayout causing it to "ignore" the sizing? I know that the parts, other than the center, have some sizing control, that's why I tried to use a BoxLayout in the center.
Is it possible to keep the BorderLayout, and get it to work, with some other modifications, or would I need to switch to some other Layout Manager?
Thanks!