posted 17 years ago
All,
I've got a JFrame whose contentPane has the typical BorderLayout setup.
I want to put a JComponent in the BorderLayout.CENTER area, so I do the following:
Naturally, since myJComponent is the ONLY thing that's been added, since it's in the CENTER, the component is expanded to fill the entire contentPane, as the red border will indicate.
HOWEVER, the actual visible part of myJComponent then gets shoved into the upper-left corner, whereas I want it centered both horizontally and vertically.
I've tried using setAlignmentX and setAlignmentY on the myJComponent to no avail. I have a feeling I'm missing something dreadfully obvious, but can't figure out what it is.
Thanks in advance for any guidance anyone can give me on this.
[ February 22, 2008: Message edited by: Joe Vahabzadeh ]