Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;

public class Main {

    static {
        System.setProperty("apple.laf.useScreenMenuBar", "true");
    }

    public static void main(String[] args) {
        JFrame frame = new JFrame("Menu Bar Demo");
        JMenuBar bar = new JMenuBar();
        JMenu fileMenu = new JMenu("File");
        JMenu editMenu = new JMenu("Edit");
        JMenu helpMenu = new JMenu("Help");
        bar.add(fileMenu);
        bar.add(editMenu);
        bar.add(helpMenu);
        frame.setSize(300, 150);
        frame.setJMenuBar(bar);
        frame.setVisible(true);
    }

}