Here you can find the source of createInsetTitledBorder(String title)
public static Border createInsetTitledBorder(String title)
//package com.java2s; /******************************************************************************* * Copyright (c) 2014 Open Door Logistics (www.opendoorlogistics.com) * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at http://www.gnu.org/licenses/lgpl.txt ******************************************************************************/ import java.awt.Color; import java.awt.Font; import javax.swing.*; import javax.swing.border.Border; import javax.swing.border.TitledBorder; public class Main { private static final Font BORDER_FONT = new Font(Font.SANS_SERIF, Font.BOLD, 13); public static Border createInsetTitledBorder(String title) { return BorderFactory.createCompoundBorder( new TitledBorder(BorderFactory.createLineBorder(Color.DARK_GRAY, 2), title, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, BORDER_FONT), BorderFactory.createEmptyBorder(5, 5, 5, 5)); }//w ww . jav a 2 s . c om }