0% found this document useful (0 votes)
3 views1 page

12B. Program To Create Menu Bar and Pull-Down Menus. Import Java - Awt.

The document presents a Java program that creates a simple graphical user interface with a menu bar and pull-down menus. It includes menus for 'File' and 'Edit' with options such as 'New', 'Open', 'Print', 'Save', 'Cut', and 'Copy'. The program initializes a frame and sets the menu bar, making the interface visible to the user.

Uploaded by

priya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

12B. Program To Create Menu Bar and Pull-Down Menus. Import Java - Awt.

The document presents a Java program that creates a simple graphical user interface with a menu bar and pull-down menus. It includes menus for 'File' and 'Edit' with options such as 'New', 'Open', 'Print', 'Save', 'Cut', and 'Copy'. The program initializes a frame and sets the menu bar, making the interface visible to the user.

Uploaded by

priya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

12B. Program to create menu bar and pull-down menus.

import java.awt.*;
class MenuExample
{
MenuExample()
{
Frame f= new Frame("Menu and MenuItem Example");
MenuBar mb=new MenuBar();
Menu m=new Menu("File");
Menu m1=new Menu("Edit");
MenuItem i1=new MenuItem("New");
MenuItem i2=new MenuItem("Open");
MenuItem i3=new MenuItem("Print");
MenuItem i4=new MenuItem("Save");
MenuItem i5=new MenuItem("Cut");
MenuItem i6=new MenuItem("Copy");
m.add(i1);
m.add(i2);
m.add(i3);
m.add(i4);
m1.add(i5);
m1.add(i6);
mb.add(m);
mb.add(m1);
f.setMenuBar(mb);
f.setSize(300,300);
f.setLayout(null);
f.setVisible(true);
}
public static void main(String args[])
{
new MenuExample();
}
}
OUTPUT:

You might also like