Rohit143

 avatar
Rohit143
java
2 years ago
807 B
1
Indexable
Never
import java.awt.*;
/**
 * MyMenu extends Frame
 */
 class MyMenu extends Frame {
     MenuBar mb;
     Menu file,edit,view;
     MenuItem newItem,openItem;

   MyMenu(){
       setVisible(true);
       setSize(500, 500);

       mb = new MenuBar();
       file = new Menu("File");
       edit = new Menu("Edit");
       view = new Menu("View");
       newItem = new MenuItem("New");
       openItem = new MenuItem("Open");

       Label label =new Label("By Rohit Nandagawali");
       label.setBounds(20, 40, 200, 20);
       add(label);


       setMenuBar(mb);
       mb.add(file); mb.add(edit); mb.add(view);
       file.add(newItem); file.add(openItem);

   } 
}
public class practical5 {
   public static void main(String[] args) {
    new MyMenu();
   }
    
}