Reputation: 729
I have a JPanel that is located at the BorderLayout.SOUTH position of a parent JPanel. I would like to programatically change the height of this child JPanel.
I am calling childPanel.setPreferredSize(new Dimension(getWidth(), newHeight));
, but it has no effect. (I have tried setting the Maximum and Minimum sizes as well.)
What (probably very simple thing) am I missing?
Upvotes: 1
Views: 2713
Reputation: 47608
After changing the preferred size, you need to call revalidate() on that childPanel.
You may want to read this Oracle Tutorial on LayoutManagers
Upvotes: 4