Java tutorial
//package com.java2s; import javax.swing.JComponent; import javax.swing.border.Border; import javax.swing.border.TitledBorder; public class Main { /** * GUI utility (change border title) * * @param panel * bborder component * @param title * new title */ public static void borderTitle(JComponent panel, String title) { Border b = panel.getBorder(); if (b instanceof TitledBorder) ((TitledBorder) b).setTitle(title); } }