Java tutorial
import java.awt.Color; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.border.Border; import javax.swing.border.LineBorder; import javax.swing.border.TitledBorder; public class Main { public static void main(String[] argv) { LineBorder border1 = new LineBorder(Color.red); TitledBorder border2 = new TitledBorder("asdf"); Border newBorder = BorderFactory.createCompoundBorder(border1, border2); JButton component = new JButton("button"); component.setBorder(newBorder); } }