Mega Code Archive

 
Categories / Java Tutorial / Swing
 

Creating and Setting a line Border from BorderFactory

import java.awt.Color; import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.border.LineBorder; public class Main {   public static void main(String[] argv) {     LineBorder lineBorder = (LineBorder)BorderFactory.createLineBorder(Color.black);     JLabel component = new JLabel("label");     component.setBorder(lineBorder);   } }