If I understood correctly, you need an interface something like this:
+ -------- Parent panel -------- +
| |
| |
| + --- Child panel ---- + |
| | | |
| | | |
| | | |
| | | |
| + -------------------- + |
| |
| |
+ ------------------------------ +
... and you have no other components added to the parent panel.
, , ( , , , ):
GridBagLayout GridBagConstraints , :
parent_panel.setLayout(new GridBagLayout());
parent_panel.add(child_panel, new GridBagConstraints());
BoxLayout, :
parent_panel.setLayout(new BoxLayout(parent_panel, BoxLayout.PAGE_AXIS));
Box horizontalBox = Box.createHorizontalBox();
horizontalBox.add(Box.createHorizontalGlue());
horizontalBox.add(child_panel);
horizontalBox.add(Box.createHorizontalGlue());
Box verticalBox = Box.createVerticalBox();
verticalBox.add(Box.createVerticalGlue());
verticalBox.add(horizontalBox);
verticalBox.add(Box.createVerticalGlue());