import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class access extends JFrame
{
MenuBar mb; //TO CREATE MENU
Menu m1,m2,m3;
MenuItem mi1,mi2,mi3,mi4,mi5; // TO CREATE PARTICULAR MENU ITEM IN MENU
access()
{
Container c=getContentPane();
JLabel jl=new JLabel("Menu Bar Example");
jl.setBounds(60,10,770,30);
jl.setFont(new Font("Times New Roman", Font.BOLD,30));
jl.setBackground(Color.black);
jl.setForeground(Color.blue);
c.add(jl);
JLabel jl2=new JLabel(new ImageIcon("images/c1.jpg"));
jl2.setBounds(550,100,350,170);
jl2.setBackground(Color.black);
c.add(jl2);
JLabel jl4=new JLabel(new ImageIcon("images/c1.jpg"));
jl4.setBounds(150,100,350,170);
jl4.setBackground(Color.black);
c.add(jl4);
JLabel jlab=new JLabel(new ImageIcon("images/welcome1.gif"));
jlab.setBounds(0,0,800,600);
jlab.setLayout(null);
c.add(jlab);
mb=new MenuBar();
m1=new Menu("FILE"); //DEFINING MENU
m2=new Menu("ADMIN");
m3=new Menu("USER");
mi1=new MenuItem("Click This"); //defining menu item under file menu
mi2=new MenuItem("REGISTER"); //defining menu item under file menu
mi3=new MenuItem("ADMIN LOGIN");
mi4=new MenuItem("USER LOGIN");
m1.add(mi1);
m1.add(mi2);
m2.add(mi3);
m3.add(mi4);
mb.add(m1);
mb.add(m2);
mb.add(m3);
setMenuBar(mb);
setSize(1024,768);
setVisible(true);
setTitle("Menu Bar Example");
}
public static void main(String ar[])
{
access ac=new access();
}
No comments:
Post a Comment