Mega Code Archive

 
Categories / Java by API / Javax Swing
 

New JSeparator()

import java.awt.GridLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JSeparator; public class MainClass {   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);   } }