Here you can find the source of createTitledBorder(String label)
public static Border createTitledBorder(String label)
//package com.java2s; //License from project: Open Source License import java.awt.Color; import java.awt.Font; import javax.swing.BorderFactory; import javax.swing.border.Border; import javax.swing.border.TitledBorder; public class Main { private static Border lineBorder = BorderFactory.createLineBorder(Color.BLUE, 3); private static Font borderFont = new Font("Verdana", Font.BOLD, 20); public static Border createTitledBorder(String label) { TitledBorder border = BorderFactory.createTitledBorder(lineBorder, label); border.setTitleFont(borderFont); return border; }//from www .java 2 s. co m }