aspose file tools
The moose likes Swing / AWT / SWT and the fly likes Resizing JPanel and its inner components when JFrame is maximised Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Resizing JPanel and its inner components when JFrame is maximised" Watch "Resizing JPanel and its inner components when JFrame is maximised" New topic
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
    
    2
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.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Resizing JPanel and its inner components when JFrame is maximised
 
Similar Threads
Save information in SQL database using timer
Resizing components
JList deleting multiple items
Won't repaint!
Prevent Duplicate value from jlist to jlist by way of a jbutton