BorderFactory.createStrokeBorder(BasicStroke stroke) has the following syntax.
public static Border createStrokeBorder(BasicStroke stroke)
In the following code shows how to use BorderFactory.createStrokeBorder(BasicStroke stroke) method.
/*from w w w .j a v a2 s.c o m*/ import java.awt.BasicStroke; import java.awt.FlowLayout; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JLabel; public class Main extends JFrame { public Main(String name) { getContentPane().setLayout(new FlowLayout()); JLabel labelTwo = new JLabel("www.java2s.com"); labelTwo.setBorder(BorderFactory.createStrokeBorder(new BasicStroke(0))); add(labelTwo); } public static void main(String[] args) { JFrame frame = new Main("javax.swing.JButton"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } }