Menu in Awt

//Menu Creation :
//[Note :- MenuBar :- to create menu bar
//Menu :- to create menu
//MenuItem :- to create menu item ]


import java.awt.*;

public class MenuWindow extends Frame {
	MenuBar mb;
	Menu file, edit;
	MenuItem new1, open, save, close, exit, cut, copy, paste;

	public MenuWindow() {
		mb = new MenuBar();
		setMenuBar(mb);
		file = new Menu("File");
		edit = new Menu("Edit");
		new1 = new MenuItem("new");
		open = new MenuItem("open");
		save = new MenuItem("save");
		close = new MenuItem("close");
		exit = new MenuItem("exit");
		cut = new MenuItem("cut");
		copy = new MenuItem("copy");
		paste = new MenuItem("paste");
		file.add(new1);
		file.add(open);
		file.add(save);
		file.addSeparator();
		file.add(close);
		file.add(exit);
		edit.add(cut);
		edit.addSeparator();
		edit.add(paste);
		mb.add(file);
		mb.add(edit);
	}

	public static void main(String s[]) {
		MenuWindow mb = new MenuWindow();
		mb.setLocation(50, 1);
		mb.setSize(400, 400);
		mb.setTitle("MenuExample");
		mb.setVisible(true);
	}
}

Download

Menu in Swing

Complete Menu example, Menubar,MenuItem etc
Menubar and Menu Item in Awt
Opoup Menu in Swing


Write your Comment

Name :
Email Id : [ We will not publish your email id ]
Your Comment : [ Maximum 200 chars ]
Enter Security code