Separator Sample : Separator « Swing Components « Java






Separator Sample

Separator Sample
import java.awt.BorderLayout;
import java.awt.Container;

import javax.swing.JFrame;
import javax.swing.JSeparator;

public class SeparatorSample {
  public static void main(String args[]) {
    JFrame frame = new JFrame("Separator Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JSeparator north = new JSeparator(JSeparator.HORIZONTAL);
    JSeparator south = new JSeparator(JSeparator.VERTICAL);
    JSeparator east = new JSeparator(JSeparator.HORIZONTAL);
    JSeparator west = new JSeparator(JSeparator.VERTICAL);
    Container contentPane = frame.getContentPane();
    contentPane.add(north, BorderLayout.NORTH);
    contentPane.add(south, BorderLayout.SOUTH);
    contentPane.add(east, BorderLayout.EAST);
    contentPane.add(west, BorderLayout.WEST);
    frame.setSize(350, 250);
    frame.setVisible(true);
  }
}

           
       








Related examples in the same category

1.A demonstration of the JSeparator() component used in a toolbar-likeA demonstration of the JSeparator() component used in a toolbar-like
2.Separator Sample 2Separator Sample 2