nope3d -6 Newbie Poster

....Can anyone knows how to put some functions that if I run my program, the menu will disable my logoff menu, Maintenance and emloyee and the auhtor.........but if i press my log in it will enables the log off menu, Maintenace and employee and the author itself.... then the log in is disabled.....

well here is my codes.....

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class menuFinal extends JFrame implements ActionListener{

//GUI components
private JMenuBar menuMB=new JMenuBar();
private JMenu fileM,maintenanceM,aboutM;
private JMenuItem logIn,logOff,exit1;
private JMenuItem employee1;
private JMenuItem author1;
Image image;

public menuFinal()
{
setTitle("Menu");
Container pane=getContentPane();
pane.setLayout(new BorderLayout());
setJMenuBar(menuMB);
setfileMenu();
setmaintenanceMenu();
setaboutMenu();
setSize(400,300);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
private void setfileMenu()
{
	fileM=new JMenu("File");
	menuMB.add(fileM);
	logIn=new JMenuItem("logIn");
	fileM.add(logIn);
	logIn.addActionListener(this);
	logOff=new JMenuItem("logOff");
	fileM.add(logOff);
	logOff.addActionListener(this);
	exit1=new JMenuItem("Exit");
	fileM.add(exit1);
	exit1.addActionListener(this);


	logIn.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){
				if(!logIn.getText().equals("JLabel"))
				JOptionPane.showMessageDialog(null,"Are you sure you want to logIn?");

				}

			});

logOff.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){
				if(!logOff.getText().equals("JLabel"))
				JOptionPane.showMessageDialog(null,"Are you sure you want to logOff?");

				}

			});
			exit1.addActionListener(new ActionListener(){
						public void actionPerformed(ActionEvent e){
							if(!exit1.getText().equals("JLabel"))
							JOptionPane.showMessageDialog(null,"Are you sure you want to Exit?");

							}
						});



}
private void setmaintenanceMenu()
{
	maintenanceM=new JMenu("Maintenance");
	menuMB.add(maintenanceM);
	employee1=new JMenuItem("Employee");
	maintenanceM.add(employee1);
	employee1.addActionListener(this);
		maintenanceM.addActionListener(new ActionListener(){
							public void actionPerformed(ActionEvent e){
								if(!maintenanceM.getText().equals("JLabel"))
							JOptionPane.showMessageDialog(null,"Are you sure you want to Open?");


								}


							});


}
private void setaboutMenu()
{
	aboutM=new JMenu("About");
	menuMB.add(aboutM);
	author1=new JMenuItem("About Author");
	aboutM.add(author1);
	author1.addActionListener(this);


	author1.addActionListener(new ActionListener(){
		public void actionPerformed(ActionEvent ae){
			JOptionPane.showMessageDialog(null,"Created by: \nTanilon, Jerome S.\nBSIT-2\nSubmitted to:\nMrs.  Emelie C. Villaseran");
			//if(!author1.getText().equals("JLabel"))
			//JOptionPane.showMessageDialog(null,"MGA GWAPO NOH?");
			}
		});

    }








	public void actionPerformed(ActionEvent e)
	{

		JMenuItem maintenanceM=(JMenuItem)e.getSource();

if(e.getSource()==employee1)
{
	new employee2();
	}
		JMenuItem mItem=(JMenuItem)e.getSource();

if(e.getSource()==logIn)
{
	new logInForm();
	}
	if(e.getSource()==logOff)
	{
		System.exit(0);
}
JMenuItem fileM=(JMenuItem)e.getSource();
	if(e.getSource()==exit1)
{
System.exit(0);
}

}
public  static void main(String [] args)throws Exception {

	menuFinal texted=new menuFinal();

	}
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.