• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPanel

 
ramesh kancherla
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I change Jpanel Resize
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the setMinimumSize, setPreferredSize and setMaximumSize methods.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48940
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't. There isn't actually a resize() method in JPanel, but there is in Component, but it is deprecated. Read the details in the API.

If you do alter the size of a Component, you may have to call validate() and pack() on its enclosing Container as well.
 
Rob Spoor
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't guarantee the panel will get that size at all. It's all up to the layout manager of the enclosing container.

pack() is only part of Window and its subclasses, as well as JInternalFrame and JPopupMenu.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic