private JPanel createSubGroupPanel(String labelText){
  JLabel subGroupLabel=new JLabel();
  Font font=subGroupLabel.getFont();
  font=font.deriveFont(Font.BOLD,14f);
  subGroupLabel.setFont(font);
  subGroupLabel.setForeground(SettingsTabs.COLOR_SUBGROUP);
  subGroupLabel.setText(labelText);
  int top=SUBGROUP_TOP_MARGIN;
  if (isFirstSubGroup) {
    isFirstSubGroup=false;
    top=FIRST_SUBGROUP_TOP_MARGIN;
  }
  subGroupLabel.setBorder(BorderFactory.createEmptyBorder(top,0,7,0));
  JPanel subGroupPanel=new JPanel();
  subGroupPanel.setLayout(new BoxLayout(subGroupPanel,BoxLayout.LINE_AXIS));
  subGroupPanel.add(subGroupLabel);
  subGroupPanel.add(Box.createHorizontalGlue());
  return subGroupPanel;
}

private JPanel createSubGroupPanel ( String labelText ) { JLabel subGroupLabel = new JLabel ( ) ; Font font = subGroupLabel . getFont ( ) ; font = font . deriveFont ( Font . BOLD , 14f ) ; subGroupLabel . setFont ( font ) ; subGroupLabel . setForeground ( SettingsTabs . COLOR_SUBGROUP ) ; subGroupLabel . setText ( labelText ) ; int top = SUBGROUP_TOP_MARGIN ; if ( isFirstSubGroup ) { isFirstSubGroup = false ; top = FIRST_SUBGROUP_TOP_MARGIN ; } subGroupLabel . setBorder ( BorderFactory . createEmptyBorder ( top , 0 , 7 , 0 ) ) ; JPanel subGroupPanel = new JPanel ( ) ; subGroupPanel . setLayout ( new BoxLayout ( subGroupPanel , BoxLayout . LINE_AXIS ) ) ; subGroupPanel . add ( subGroupLabel ) ; subGroupPanel . add ( Box . createHorizontalGlue ( ) ) ; return subGroupPanel ; }
creates a panel with a heading .
