1
Find errors in following program
import java.awt.*;
import java.awt.event. *;
public class MenuDemol extends Frame
MenuBar mb;
MenuItem m1.m2,m3.m4;
Menu mn;
MenuShortcut ms;
MenuDemol
set Title("MenuBar Demo");
setSize(500,500);
setLayout(null);
ms-new MenuShortcut(KeyEvent. VK_X);
mn=new Menu("File");
mb-new MenuBar();
ml-new Menultem("New...");
m2=new Menultem("Open...");
m3-new Menultem("Save As...");
m4=new Menultem("Exit",ms);
mn.add(M1);
mn.add(m2);
mn.add(M3);
mn.addseparator();
mn.add(m4);
mb.add(mn);
}
public static void main(string[]arts)
{
menuDemo1 md=new menuDemo1();
md.setVisible(true);
}
}
Answers
Answered by
2
Answer:
last line is wrong
Explanation:
I think so not the exact answer
Answered by
0
1 error:we have to call setMenuBar(mb);
Explanation:
to setMenuBar on frame we need to call setMenuBar () otherwise it will not display menubar
Similar questions