Swing layout in java
    Swing layout :     In our simple Swing program, we specified the  location of our various components inside the window with some constants: BorderLayout.CENTER , BorderLayout.SOUTH  etc.  In general, a window has a particular layout , and that when we add a  component to the window, we add it in a particular position  in that  layout.     BoxLayout     BoxLayout arranges components either  horizontally or vertically  in a panel. You can control  alignment and spacing of the components. Complicated layouts can be made by  combining many panels, some with horizontal layout and some with vertical  layouts. Several classes are typically used: javax.swing.BoxLayout , javax.swing.Box , and javax.swing.Box.Filler .       To  Create a JPanel with BoxLayout     Choose either a horizontal layout ( BoxLayout.X_AXIS ) or vertical layout ( BoxLayout.Y_AXIS )  for a JPanel.     JPanel  p  = new JPanel();     p . setLayout(new  BoxLayout( p , BoxLayout.Y_AXIS));     p .add( some_component );     ...