• Post Reply Bookmark Topic Watch Topic
  • New Topic

Minimum Size on JPanel  RSS feed

 
Freya Impens
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JPanel with a GridBagLayout on it, and I don't know how to set a minimumSize on the JPanel. I want to prevent the user to resize the panel to small. setMinimumsize doesn't seem to work.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"F IP" -

Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy.
You can change it here.

Are you talking about a panel inside the panel with GridBagLayout set on it, or are you talking about the panel itself? If you're talking about the panel inside the GridBagLayout, then you'll need to mess with the GridBagConstraints for this panel to handle it correctly. If you're talking about wanting the frame to not resize smaller than the minimum size of the panel... you can't do that in a really good way. It's better to just set the frame to a specific size and call setResizable( false ) on it.

Thanks! and welcome to the JavaRanch!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!