Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JSeparator;

public class Main {
    public static void main(String[] argv) throws Exception {
        JMenu menu = new JMenu("Menu Label");

        JMenuItem item1 = new JMenuItem("Item Label");
        menu.add(item1);

        // Add separator
        menu.add(new JSeparator());

        // Add another menu item
        JMenuItem item2 = new JMenuItem("Item Label");
        menu.add(item2);
    }
}