JSeparator() constructor from JSeparator has the following syntax.
public JSeparator()
In the following code shows how to use JSeparator.JSeparator() constructor.
import java.awt.GridLayout; /* w w w . j av a 2 s. c o m*/ import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JSeparator; public class Main { public static void main(String args[]) { JFrame f = new JFrame("JSeparator Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout(new GridLayout(0, 1)); JLabel above = new JLabel("Above Separator"); f.add(above); JSeparator separator = new JSeparator(); f.add(separator); JLabel below = new JLabel("Below Separator"); f.add(below); f.setSize(300, 100); f.setVisible(true); } }