import java.awt.Container;
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
class Demo extends JFrame /*implements ActionListener*/
{
JMenu jm1,jm2;
JMenuBar jb;
JMenuItem jl1,jl2,jl3,jl4,jl5,jl6;
Demo()
{
jb= new JMenuBar();
jm1=new JMenu("Home");
jm2=new JMenu("Product");
jl1=new JMenuItem("File1");
jl2=new JMenuItem("File2");
jl3=new JMenuItem("File3");
jl4=new JMenuItem("Product1");
jl5=new JMenuItem("Product2");
jl6=new JMenuItem("Product3");
Container c= getContentPane();
c.setLayout(new FlowLayout());
setSize(500,500);
c.add(jb);
jb.add(jm1);
jb.add(jm2);
jm1.add(jl1);
jm1.add(jl2);
jm1.add(jl3);
jm2.add(jl4);
jm2.add(jl5);
jm2.add(jl6);
}
}
public class Jmenu {
public static void main(String arg[]){
Demo d=new Demo();
d.setVisible(true);
}
}
A blog provide anexample with sample code for swing , servlet, jdbc and odbc connection to database, jsp, servlets, taglib, sql server, cassandra and many more. we also provide Apache camel sample code for integration.
Monday, November 5, 2012
How to create Jmenu
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment