Package gui

Source Code of gui.Menu

package gui;

import gui.actions.ActionManager;
import gui.listeners.MainMenuListener;

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

@SuppressWarnings("serial")
public class Menu extends JMenuBar{

  private JMenu fileMenu;
  private JMenu editMenu;
  private JMenu helpMenu;
 
  public Menu() {
    fileMenu = new JMenu("File");
    editMenu = new JMenu("Edit");
    helpMenu = new JMenu("Help");
   
    fileMenu.setMnemonic('f');
    editMenu.setMnemonic('e');
    helpMenu.setMnemonic('h');
   
    add(fileMenu);
    add(editMenu);
    add(helpMenu);
   
    fileMenu.add(ActionManager.getInstance().getNewFileAction());
    fileMenu.add(ActionManager.getInstance().getOpenFileAction());
    fileMenu.add(ActionManager.getInstance().getSaveAction());
    fileMenu.add(ActionManager.getInstance().getSaveAsAction());
    fileMenu.addSeparator();
    fileMenu.add(ActionManager.getInstance().getQuitAction());
   
    editMenu.add(ActionManager.getInstance().getUndoAction());
    editMenu.add(ActionManager.getInstance().getRedoAction());
    editMenu.addSeparator();
    editMenu.add(ActionManager.getInstance().getDeleteAction());
    editMenu.add(ActionManager.getInstance().getMoveAction());
    editMenu.add(ActionManager.getInstance().getResizeAction());
   
    helpMenu.add(ActionManager.getInstance().getAboutAction());
   
    MainMenuListener mml = new MainMenuListener();
   
    fileMenu.addMenuListener(mml);
    editMenu.addMenuListener(mml);
    helpMenu.addMenuListener(mml);
  }
 
}
TOP

Related Classes of gui.Menu

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.