0% found this document useful (0 votes)
13 views2 pages

Practical No 5

AJP Practical No. 5

Uploaded by

xamexi1077
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)
13 views2 pages

Practical No 5

AJP Practical No. 5

Uploaded by

xamexi1077
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/ 2

Practical No.

: 05

Practical Name: Write a program using AWT to create a menu bar where menu bar contains menu
items such as File, Edit, View and create a submenu under the File menu: New and Open.

Roll No.: 47

Student Name: Mavani Ashish Shantilal

Program:

import java.awt.*;

class practical5
{
public static void main(String args[])
{
Frame f = new Frame("Practical 5");
f.setVisible(true);
f.setSize(400,300);
f.setLayout(new FlowLayout());

MenuBar mb = new MenuBar();


Menu m = new Menu("Colors");
MenuItem i1 = new MenuItem("Red");
MenuItem i2 = new MenuItem("Yellow");
MenuItem i3 = new MenuItem("Green");
MenuItem i4 = new MenuItem("Black");
i4.setEnabled(false);
MenuItem i5 = new MenuItem("Blue");
MenuItem i6 = new MenuItem("White");

m.add(i1);
m.add(i2);
m.add(i3);
m.add(i4);
m.add(i5);
m.add(i6);

mb.add(m);

f.setMenuBar(mb);
}
}
Output:

You might also like