Create a title border from another border
import java.awt.Color; import javax.swing.BorderFactory; import javax.swing.border.LineBorder; import javax.swing.border.TitledBorder; public class Main { public static void main(String[] argv) { LineBorder border = new LineBorder(Color.red); TitledBorder titledBorder = BorderFactory.createTitledBorder(border, "Title"); } }