Skip to Main Content

Java SE (Java Platform, Standard Edition)

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!

forcing JPanel to fill entire BorderLayout region

843805Feb 24 2006 — edited Feb 24 2006
I've built a JPanel which contains a couple of widgets, and now I'd like to add it to a JFrame that uses a BorderLayout as its layout manager. I'm adding the panel to the north region of the frame, and would like the panel to expand to fill up the entire region. Currently the panel gets centered in the region and I can't figure out how to make it grow horizontally to fill up the whole thing. I'd prefer not to call setSize() on the panel, since that won't work if the user resizes the JFrame (right?).

What do I have to do in order to have the panel behave as I want? The panel itself, the layout manager, or something else?

thanks for any help.

- Dan
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 24 2006
Added on Feb 24 2006
8 comments
3,264 views