Reputation: 7327
I read that if a minimum size has not been set on a jpanel, a call to getMinimumSize will be delegated to the panel's layout manager. If a minimum size is set on a panel, then this dimension will be returned when getMinimumSize is called, and not the layout manager's. I want to set only a minimum height on my JPanel and leave the retrieval of the minimum width to the panel's layout manager, as I want to leave the minimum width to be whatever the layout manager decides. Is it possible to set only the minimum height on the JPanel?
Upvotes: 2
Views: 4618
Reputation: 57381
Override getMinimumSize()
method. In the method call super
and replace the height in the result.
Upvotes: 6