Saturday, 30 June 2012

program that demostrate example of simple menu using applet.


import java.awt.*;
import java.applet.*;
import java.awt.event.*;
/* <applet code="simplemenu" height=300 width=200>
   </applet>
*/
public class simplemenu extends Frame
{
      simplemenu()
      {
            super("Menu Example");
            Menu m = new Menu("File",true);
            m.add(new MenuItem("New Web Browser ",new MenuShortcut('n')));
            m.add(new MenuItem("New Mail Message ",new MenuShortcut('n',true)));
            m.add(new MenuItem("New Folder"));
            m.addSeparator();
            m.add(new MenuItem("Close"));
            m.add(new MenuItem("Quit"));
           
            MenuBar mb = new MenuBar();
            mb.add(m);
            setMenuBar(mb);
            resize(200,200);
       }
       public static void main(String args[])
       {
             simplemenu f = new simplemenu();
             f.show();
       }
}