void () { final GroupLayout layout = new GroupLayout(this); setLayout(layout); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup( layout.createParallelGroup() .addGroup( layout.createSequentialGroup() .addComponent(myTypeLabel) .addComponent(myTextField) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 1, 1) .addComponent(myHelpLabel) ) .addGroup( layout.createSequentialGroup() .addComponent(myHierarchyCheckBox) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(myRegexCheckBox) ) ); layout.setVerticalGroup( layout.createSequentialGroup() .addGroup( layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myTypeLabel) .addComponent(myTextField) .addComponent(myHelpLabel) ) .addGroup( layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myHierarchyCheckBox) .addComponent(myRegexCheckBox) ) ); }