Here you can find the source of createBox(Component center, Component north, Component south, Component west, Component east)
public static JPanel createBox(Component center, Component north, Component south, Component west, Component east)
//package com.java2s; /*// w w w. j a v a 2s .com * Spirit, a study/biosample management tool for research. * Copyright (C) 2018 Idorsia Pharmaceuticals Ltd., Hegenheimermattweg 91, * CH-4123 Allschwil, Switzerland. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/> * * @author Joel Freyss */ import java.awt.BorderLayout; import java.awt.Component; import javax.swing.JPanel; import javax.swing.border.Border; public class Main { public static JPanel createBox(Component center, Component north, Component south) { return createBox(null, center, north, south, null, null); } public static JPanel createBox(Component center, Component north) { return createBox(null, center, north, null, null, null); } public static JPanel createBox(Border border, Component center, Component north) { return createBox(border, center, north, null, null, null); } public static JPanel createBox(Border border, Component center, Component north, Component south) { return createBox(border, center, north, south, null, null); } public static JPanel createBox(Border border, Component center) { return createBox(border, center, null, null, null, null); } public static JPanel createBox(Component center, Component north, Component south, Component west, Component east) { return createBox(null, center, north, south, west, east); } public static JPanel createBox(Border border, Component center, Component north, Component south, Component west, Component east) { JPanel panel = new JPanel(new BorderLayout()); panel.setOpaque(false); if (center != null) panel.add(BorderLayout.CENTER, center); if (north != null) panel.add(BorderLayout.NORTH, north); if (south != null) panel.add(BorderLayout.SOUTH, south); if (west != null) panel.add(BorderLayout.WEST, west); if (east != null) panel.add(BorderLayout.EAST, east); if (border != null) panel.setBorder(border); return panel; } }