Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to set an empty JPanel to maximum size?

803515Jan 18 2012 — edited Jan 19 2012
Hello!

I created class extends JFrame.

I want this maximum size so I set the minimum size as screen size:
setSize(screenWidth,screenHeight);

Now I added an empty JPanel,
and I want it to be the maximum size.
But the problem is - I don't know what is the maximum of the current size without the frame borders. I mean, after set it to maximum size (I don't know how),
I could get the width and height of the current size without the frame borders by:

frame.getContentPane().getSize();

In conclusion, I want to set an empty JPanel to maximum size and get JFrame size without the frame borders.

Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 16 2012
Added on Jan 18 2012
3 comments
1,355 views