Java examples for Swing:Layout Manager
add To Vertical Border Layout
//package com.java2s; import java.awt.BorderLayout; import javax.swing.JComponent; import javax.swing.JPanel; public class Main { public static JPanel addToVerticalBorderLayout(JComponent north, JComponent center, JComponent south) { JPanel panel = new JPanel(new BorderLayout()); if (north != null) { panel.add(north, BorderLayout.NORTH); }/*from w ww . j a v a 2 s. c om*/ if (center != null) { panel.add(center, BorderLayout.CENTER); } if (south != null) { panel.add(south, BorderLayout.SOUTH); } return panel; } }