Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.GridLayout;

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);
    }
}