import java.awt.*; public class FrameMenus extends java.applet.Applet { FrameM frameM; public void init() { frameM = new FrameM(); } } class FrameM extends Frame { public FrameM() { setTitle("Frame Menus"); CheckboxMenuItem a,b; MenuBar menuBar = new MenuBar(); Menu fileMenu = new Menu("File"); fileMenu.add(new MenuItem("New Web Browser Alt+N")); fileMenu.add(new MenuItem("New Mail Message Alt+M")); fileMenu.add(new MenuItem("Mail Document")); fileMenu.addSeparator(); fileMenu.add(new MenuItem("Open Location... Alt+L")); fileMenu.add(new MenuItem("Open File... Alt+O")); fileMenu.add(new MenuItem("Save As... Alt+S")); fileMenu.add(new MenuItem("Upload File~")).disable(); fileMenu.addSeparator(); fileMenu.add(new MenuItem("Print... Alt+P")); fileMenu.addSeparator(); fileMenu.add(new MenuItem("Close Alt+W")).disable(); fileMenu.add(new MenuItem("Exit Alt+Q")); menuBar.add(fileMenu); Menu bookmarks = new Menu("Bookmarks"); Menu courses = new Menu("Courses"); courses.add(new MenuItem("Java")); courses.add(new MenuItem("VRML")); courses.add(new MenuItem("CGI")); bookmarks.add(courses); menuBar.add(bookmarks); Menu colorMenu = new Menu("Color"); colorMenu.add(new MenuItem("red")); colorMenu.add(new MenuItem("green")); colorMenu.add(new MenuItem("blue")); Menu helpMenu = new Menu("Help"); helpMenu.add(new MenuItem("About Netscape")); helpMenu.add(new MenuItem("About Plug-ins")); helpMenu.add(new MenuItem("Registeration Information")); helpMenu.add(new MenuItem("Software")); helpMenu.addSeparator(); helpMenu.add(new MenuItem("Handbook")); a = new CheckboxMenuItem("see false"); helpMenu.add(a); a.setState(false); b = new CheckboxMenuItem("see true"); helpMenu.add(b); b.setState(true); menuBar.setHelpMenu(helpMenu); setMenuBar(menuBar); resize(400,500); show(); } public boolean action(Event evt, Object arg) { if (evt.target instanceof MenuItem) { if (arg.equals("Exit Alt+Q")) { dispose(); } else return false; } return true; } }