Here you can find the source of setBorder(JComponent component, String text, int titleJustification)
public static void setBorder(JComponent component, String text, int titleJustification)
//package com.java2s; //License from project: LGPL import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.border.TitledBorder; public class Main { public static void setBorder(JComponent component, String text, int titleJustification) { component.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), text, titleJustification, TitledBorder.TOP)); }/* w ww .jav a 2 s. c om*/ }