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);
# 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 ?
# 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.
# 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.