• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Resizing JPanel and its inner components when JFrame is maximised

 
Anusha Bhatnagar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm using a JPanel with absolute Layout Manager.Then I add it to my Frame.I want to resize the components and the panel when the frame is maximised.I have tried many ways but nothing seems to work like trying using BorderLayout for the frame when adding the panel etc

Here the code skeleton
 
Rob Camick
Ranch Hand
Posts: 2599
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using a JPanel with absolute Layout Manager.


That is your problem. Don't use a null layout.

Simply create a panel and add it to the frame using:



By default it will go to the CENTER of the BorderLayout and will automatically size whenever the frame is resized.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic