package view;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

import view.dialogs.AddComputerDialog;

public class CompStoreMenuBar extends JMenuBar implements ActionListener {

    private static final long serialVersionUID = 2973555574160940115L;
	private CompStoreGUI gui;

	public CompStoreMenuBar(CompStoreGUI gui){
        super();
        this.gui = gui;
        createMainMenu();
    }
       
    private void createMainMenu(){
        JMenu menu;
        menu = new JMenu("Computers");
        this.add(menu);
                
       	JMenuItem menuItem = new JMenuItem("New item...");
        menu.add(menuItem);
        menuItem.addActionListener(this);       
    }
    
	@Override
	public void actionPerformed(ActionEvent arg0)
	{
		if(arg0.getActionCommand().equals("New item...")) {
			new AddComputerDialog(gui, true);
		}
	}
	
}



