Here you can find the source of createTitledPanelBorder(String title)
public static TitledBorder createTitledPanelBorder(String title)
//package com.java2s; /**// w w w. jav a 2 s .c o m * Copyright (c) 2014, by the Authors: John E Lloyd (UBC) * * This software is freely available under a 2-clause BSD license. Please see * the LICENSE file in the ArtiSynth distribution directory for details. */ import java.awt.Font; import javax.swing.BorderFactory; import javax.swing.UIManager; import javax.swing.border.TitledBorder; public class Main { public static TitledBorder createTitledPanelBorder(String title) { TitledBorder border = BorderFactory.createTitledBorder(title); Font font = border.getTitleFont(); if (font == null) { font = UIManager.getFont("TitledBorder.font"); // Java SE 7 workaround } border.setTitleFont(new Font(font.getName(), Font.ITALIC, font.getSize())); return border; } }