JPanel默认布局的是FlowLayout可以new的时候就定义成其他布局:
JPanelp=newJPanel(newGridLayout(2,1))
;//两行一列JPanelp=newJPanel(newBorderLayout());