JavaRanch » Java Forums »
Java »
Swing / AWT / SWT
| Author |
Resizing JPanel and its inner components when JFrame is maximised
|
Anusha Bhatnagar
Greenhorn
Joined: May 24, 2011
Posts: 9
|
|
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
Joined: Jun 13, 2009
Posts: 1808
|
|
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.
|
 |
 |
|
|
subject: Resizing JPanel and its inner components when JFrame is maximised
|
|
|
|