[++] PROGRAMMING [.net]

- by Abhishek Kumar http://abhikumar163.googlepages.com/

Google
 
Web abhikumar163.googlepages.com
www.download.com www.softpedia.com

Monday, October 16, 2006

Example of using Menu Style in Java Application

Example of using Menu Style in Java Application just like NotePad



import java.awt.*;
import java.awt.event.*;
class MyMenu


{
Frame f;
MenuBar mb;
Menu m1,m2,m3,m4;
MenuItem mi1,mi2,mi3,mi4;
public MyMenu()


{
f=new Frame("Menu Bar");
mb=new MenuBar();
m1=new Menu("File");
m2=new Menu("Edit");
m3=new Menu("Format");
m4=new Menu("Help");
mi1=new MenuItem("New");
mi2=new MenuItem("Save");
mi3=new MenuItem("Load");
mi4=new MenuItem("Quit");
}
public void launch()


{
mb.add(m1);
mb.add(m2);
mb.add(m3);
mb.setHelpMenu(m4);
m1.add(mi1);
m1.add(mi2);
m1.add(mi3);
m1.addSeparator();
m1.add(mi4);
f.setMenuBar(mb);
f.setVisible(true);
}
public static void main(String a[])


{
MyMenu mm=new MyMenu();
mm.launch();
}
}

0 Comments:

Post a Comment

<< Home