Java tutorial
//package com.java2s; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.border.TitledBorder; public class Main { public static JPanel placeInTitledEtchedJPanel(Component c, String title, Color titleColor) { JPanel parent = new JPanel(new BorderLayout()); parent.add(c, BorderLayout.CENTER); TitledBorder tb = new TitledBorder(title); tb.setBorder(BorderFactory.createEtchedBorder()); tb.setTitleColor(titleColor); parent.setBorder(tb); return parent; } }