How do I center horizontally all contents using GroupLayout

I am using GroupLayout with a JPanel. Components within the layout are all positioned correctly except the components are laid out from the left handside of the pane (as in Windows) rather than in the center (as in Mac OSX). I just want to centre the main contents but cant get it to work. I tried wrapping my top level sequential group in a parallelgroup with alignment CENTER but it is no different to when I just add my sequential group as the top group.

GroupLayout.ParallelGroupcentreGroup = layout.createParallelGroup(GroupLayout.CENTER);

centreGroup.add(hGroup);

layout.setHorizontalGroup(centreGroup);

[634 byte] By [paultaylora] at [2007-11-27 8:32:36]
# 1
Use another layout manager. This question have been asked and answered in the forum before.
camickra at 2007-7-12 20:28:31 > top of Java-index,Desktop,Core GUI APIs...
# 2
Well I searched on GroupLayout and Center and was unable to find anything relevent. I have selected GroupLayout because it has done a much better job then was possible with Box,Grid or GridbagLayout. This is my one outstanding issue, can it really not be done ?
paultaylora at 2007-7-12 20:28:31 > top of Java-index,Desktop,Core GUI APIs...
# 3

> have selected GroupLayout because it has done a much better job

> then was possible with Box,Grid or GridbagLayout.

Noboy says you need to use a single LayoutManager for the entire screen. GroupLayout is a new LayoutManager. The solutions posted in this forum use the old layout managers.

camickra at 2007-7-12 20:28:31 > top of Java-index,Desktop,Core GUI APIs...
# 4
You can only use a single layout manager within a single component (in my case a JPanel), Ive designed a complex panel using GroupLayout, I dont want to start again with something else.
paultaylora at 2007-7-12 20:28:31 > top of Java-index,Desktop,Core GUI APIs...
# 5
So you add that panel to a second panel using some other layout that will center the entire panel and then you add the second panel to the GUI.Here is another posting on the topic: http://forum.java.sun.com/thread.jspa?forumID=57&threadID=609087
camickra at 2007-7-12 20:28:31 > top of Java-index,Desktop,Core GUI APIs...