Here you can find the source of setBorder(JComponent comp)
public static void setBorder(JComponent comp)
//package com.java2s; //License from project: Apache License import java.awt.Color; import javax.swing.BorderFactory; import javax.swing.JComponent; 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 void setBorder(JComponent comp) { setBorder(comp, RAISED_BORDER);/*from w w w . j av a 2 s . c o m*/ } 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); } }