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!

how to center JPanel vertically

843805Sep 9 2006 — edited Sep 11 2006
I`d like to align a JPanel to center. I`ve tried BorderLayout but I don`t want this JPanel to be forcefully extended - I want it to stay the way it is.

In this JPanel I have a few buttons that create a kind of menu and I want this menu to be in the center of the Frame. In the future I`ll probablt want to add some stuff at the bottom, top, left and right, so BorderLayout seems the perfect solution. The problem is that I don`t want the buttons to be resized to fill out the whole center area.

I`ve made a quick layout of what I mean here:
http://ilozen.republika.pl/stuff/layout.GIF
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 9 2006
Added on Sep 9 2006
7 comments
1,288 views