Here you can find the source of createPanel(Component comp, boolean setBorder, int borderType)
public static JPanel createPanel(Component comp, boolean setBorder, int borderType)
//package com.java2s; //License from project: Apache License import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.border.Border; import javax.swing.border.LineBorder; public class Main { public static final int RAISED_BORDER = 0; public static final int LOWERED_BORDER = 1; public static final int LINE_BORDER = 2; public static JPanel createPanel(Component comp, boolean setBorder) { return createPanel(comp, setBorder, RAISED_BORDER); }/*from w ww . ja v a 2s .com*/ public static JPanel createPanel(Component comp, boolean setBorder, int borderType) { JPanel panel = new JPanel(new BorderLayout()); panel.add(comp, BorderLayout.CENTER); if (setBorder) setBorder(panel, borderType); // setCompSize(labelPanel, wt, ht, 1); return panel; } public static void setBorder(JComponent comp) { setBorder(comp, RAISED_BORDER); } public static void setBorder(JComponent comp, int borderType) { Border border = BorderFactory.createRaisedBevelBorder(); if (borderType == LOWERED_BORDER) border = BorderFactory.createLoweredBevelBorder(); else if (borderType == LINE_BORDER) border = new LineBorder(Color.BLACK); comp.setBorder(border); } }