Java tutorial
//package com.java2s; //License from project: Open Source License import java.awt.Container; import javax.swing.BorderFactory; import javax.swing.JPanel; public class Main { static void setBorder(Container panel, String title) { if (panel instanceof JPanel) { ((JPanel) panel).setBorder(BorderFactory.createTitledBorder(title)); } } }