private void initializeLayout(){
  setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
  Border padding=BorderFactory.createEmptyBorder(5,5,5,5);
  if (revealOption) {
    JPanel topPanel=new JPanel();
    topPanel.setLayout(new BoxLayout(topPanel,BoxLayout.X_AXIS));
    topPanel.add(layoutCb);
    topPanel.add(Box.createHorizontalStrut(100));
    topPanel.add(layoutParameterReveal);
    topPanel.setAlignmentX(CENTER_ALIGNMENT);
    topPanel.setBorder(padding);
    add(topPanel);
  }
 else {
    layoutCb.setAlignmentX(RIGHT_ALIGNMENT);
    layoutCb.setBorder(padding);
    add(layoutCb);
  }
  layoutPanel.setVisible(layoutParameterReveal.isDown() || !revealOption);
  layoutPanel.setAlignmentX(CENTER_ALIGNMENT);
  add(layoutPanel);
  if (revealOption) {
    setBorder(BorderFactory.createTitledBorder("Layout"));
  }
  if (useApplyButton) {
    JPanel applyPanel=new JPanel(new FlowLayout(FlowLayout.RIGHT));
    applyPanel.add(applyButton);
    add(Box.createRigidArea(new Dimension(0,10)));
    add(applyPanel);
  }
}

private void initializeLayout ( ) { setLayout ( new BoxLayout ( this , BoxLayout . Y_AXIS ) ) ; Border padding = BorderFactory . createEmptyBorder ( 5 , 5 , 5 , 5 ) ; if ( revealOption ) { JPanel topPanel = new JPanel ( ) ; topPanel . setLayout ( new BoxLayout ( topPanel , BoxLayout . X_AXIS ) ) ; topPanel . add ( layoutCb ) ; topPanel . add ( Box . createHorizontalStrut ( 100 ) ) ; topPanel . add ( layoutParameterReveal ) ; topPanel . setAlignmentX ( CENTER_ALIGNMENT ) ; topPanel . setBorder ( padding ) ; add ( topPanel ) ; } else { layoutCb . setAlignmentX ( RIGHT_ALIGNMENT ) ; layoutCb . setBorder ( padding ) ; add ( layoutCb ) ; } layoutPanel . setVisible ( layoutParameterReveal . isDown ( ) || ! revealOption ) ; layoutPanel . setAlignmentX ( CENTER_ALIGNMENT ) ; add ( layoutPanel ) ; if ( revealOption ) { setBorder ( BorderFactory . createTitledBorder ( "Layout" ) ) ; } if ( useApplyButton ) { JPanel applyPanel = new JPanel ( new FlowLayout ( FlowLayout . RIGHT ) ) ; applyPanel . add ( applyButton ) ; add ( Box . createRigidArea ( new Dimension ( 0 , 10 ) ) ) ; add ( applyPanel ) ; } }
lays out the contents of the panel .
