Java tutorial
//package com.java2s; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.border.TitledBorder; public class Main { /** * Adds a basic black line border with the specified title around the given component. * @param c - the component to put the border around * @param title - the title to give the titled border */ public static void addTitledBorder(JComponent c, String title) { TitledBorder titledBorder; titledBorder = BorderFactory.createTitledBorder(title); c.setBorder(titledBorder); } }