Here you can find the source of makeTitledBorder(JComponent panel, String title, Color color)
public static TitledBorder makeTitledBorder(JComponent panel, String title, Color color)
//package com.java2s; //License from project: Apache License import javax.swing.*; import javax.swing.border.EtchedBorder; import javax.swing.border.TitledBorder; import java.awt.*; public class Main { public static TitledBorder makeTitledBorder(JComponent panel, String title, Color color) { TitledBorder result = BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), title, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, color); panel.setBorder(result);// w w w.jav a 2 s . c om return result; } }