JMenu helpMenu = new JMenu("Help"); JMenuItem aboutItem = new JMenuItem("About FindBugs"); helpMenu.add(aboutItem);  aboutItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { about(); } }); menuBar.add(helpMenu);
if (!MAC_OS_X) {  JMenu helpMenu = new JMenu("Help"); JMenuItem aboutItem = new JMenuItem("About FindBugs"); helpMenu.add(aboutItem);  aboutItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { about(); } }); menuBar.add(helpMenu); }
	protected JMenuBar createMainMenuBar() {		JMenuBar menuBar = new JMenuBar();				//Create JMenus for menuBar.		JMenu fileMenu = new JMenu("File");		fileMenu.setMnemonic(KeyEvent.VK_F);		JMenu editMenu = new JMenu("Edit");		editMenu.setMnemonic(KeyEvent.VK_E);				//Edit fileMenu JMenu object.		JMenuItem newProjectMenuItem = new JMenuItem("New Project", KeyEvent.VK_N);		JMenuItem openProjectMenuItem = new JMenuItem("Open Project...", KeyEvent.VK_O);		recentProjectsMenu = new JMenu("Recent Projects");		recentProjectsMenu.setMnemonic(KeyEvent.VK_E);		createRecentProjectsMenu();		JMenuItem saveAsProjectMenuItem = new JMenuItem("Save Project As...", KeyEvent.VK_A);		JMenuItem importBugsMenuItem = new JMenuItem("Load Analysis...", KeyEvent.VK_L);		JMenuItem exportBugsMenuItem = new JMenuItem("Save Analysis...", KeyEvent.VK_B);		JMenuItem redoAnalysis = new JMenuItem("Redo Analysis", KeyEvent.VK_R);		JMenuItem mergeMenuItem = new JMenuItem("Merge Analysis...");				JMenuItem exitMenuItem = null;		if (!System.getProperty("os.name").startsWith("Mac")) {			exitMenuItem = new JMenuItem("Exit", KeyEvent.VK_X);			exitMenuItem.addActionListener(new ActionListener(){						public void actionPerformed(ActionEvent evt){				callOnClose();			}			});		}		JMenu windowMenu = guiLayout.createWindowMenu();				attachAccelaratorKey(newProjectMenuItem, KeyEvent.VK_N);				newProjectMenuItem.addActionListener(new ActionListener(){			public void actionPerformed(ActionEvent evt){				newProjectMenu();			}		});				attachAccelaratorKey(editProjectMenuItem, KeyEvent.VK_F);		editProjectMenuItem.addActionListener(new ActionListener()		{			public void actionPerformed(ActionEvent evt)			{				saveComments(currentSelectedBugLeaf, currentSelectedBugAspects);				new NewProjectWizard(curProject);			}		});				openProjectMenuItem.setEnabled(true);		attachAccelaratorKey(openProjectMenuItem, KeyEvent.VK_O);		openProjectMenuItem.addActionListener(new ActionListener(){			public void actionPerformed(ActionEvent evt){				openProject();			}		});		mergeMenuItem.setEnabled(true);		mergeMenuItem.addActionListener(new ActionListener(){			public void actionPerformed(ActionEvent evt){				mergeAnalysis();			}		});				redoAnalysis.setEnabled(true);		attachAccelaratorKey(redoAnalysis, KeyEvent.VK_R);		redoAnalysis.addActionListener(new ActionListener(){			public void actionPerformed(ActionEvent evt){				redoAnalysis();			}		});				saveProjectMenuItem.setEnabled(false);		attachAccelaratorKey(saveProjectMenuItem, KeyEvent.VK_S);		saveProjectMenuItem.addActionListener(new ActionListener(){			public void actionPerformed(ActionEvent evt){				saveComments(currentSelectedBugLeaf, currentSelectedBugAspects);								save(projectDirectory);			}		});				saveAsProjectMenuItem.setEnabled(true);		saveAsProjectMenuItem.addActionListener(new ActionListener(){			public void actionPerformed(ActionEvent evt){				saveComments(currentSelectedBugLeaf, currentSelectedBugAspects);								if(projectSaveAs())					saveProjectMenuItem.setEnabled(true);			}		});				importBugsMenuItem.addActionListener(new ActionListener(){			public void actionPerformed(ActionEvent evt){				loadAnalysis();			}		});				exportBugsMenuItem.setEnabled(true);		exportBugsMenuItem.addActionListener(new ActionListener(){			public void actionPerformed(ActionEvent evt){				saveAnalysis();			}		});								fileMenu.add(newProjectMenuItem);		fileMenu.add(editProjectMenuItem);		fileMenu.addSeparator();		fileMenu.add(openProjectMenuItem);		fileMenu.add(recentProjectsMenu);		fileMenu.addSeparator();		fileMenu.add(saveProjectMenuItem);		fileMenu.add(saveAsProjectMenuItem);		fileMenu.addSeparator();		fileMenu.add(importBugsMenuItem);		fileMenu.add(exportBugsMenuItem);		fileMenu.addSeparator();		fileMenu.add(redoAnalysis);		fileMenu.add(mergeMenuItem);		if (exitMenuItem != null) {			fileMenu.addSeparator();			fileMenu.add(exitMenuItem);		}						menuBar.add(fileMenu);				//Edit editMenu Menu object.		JMenuItem cutMenuItem = new JMenuItem(new CutAction());		JMenuItem copyMenuItem = new JMenuItem(new CopyAction());		JMenuItem pasteMenuItem = new JMenuItem(new PasteAction());		preferencesMenuItem = new JMenuItem("Filters/Suppressions...");		JMenuItem sortMenuItem = new JMenuItem("Sort Configuration...");		JMenuItem goToLineMenuItem = new JMenuItem("Go to line...");				attachAccelaratorKey(cutMenuItem, KeyEvent.VK_X);		attachAccelaratorKey(copyMenuItem, KeyEvent.VK_C);		attachAccelaratorKey(pasteMenuItem, KeyEvent.VK_V);				preferencesMenuItem.addActionListener(new ActionListener(){			public void actionPerformed(ActionEvent evt){				saveComments(currentSelectedBugLeaf, currentSelectedBugAspects);				PreferencesFrame.getInstance().setLocationRelativeTo(MainFrame.this);				PreferencesFrame.getInstance().setVisible(true);			}		});				sortMenuItem.addActionListener(new ActionListener(){			public void actionPerformed(ActionEvent evt){				saveComments(currentSelectedBugLeaf, currentSelectedBugAspects);				SorterDialog.getInstance().setLocationRelativeTo(MainFrame.this);				SorterDialog.getInstance().setVisible(true);			}		});				attachAccelaratorKey(goToLineMenuItem, KeyEvent.VK_L);		goToLineMenuItem.addActionListener(new ActionListener(){			public void actionPerformed(ActionEvent evt){								guiLayout.makeSourceVisible();				try{					int num = Integer.parseInt(JOptionPane.showInputDialog(MainFrame.this, "", "Go To Line:", JOptionPane.QUESTION_MESSAGE));					displayer.showLine(num);				}				catch(NumberFormatException e){}			}});				editMenu.add(cutMenuItem);		editMenu.add(copyMenuItem);		editMenu.add(pasteMenuItem);		editMenu.addSeparator();		editMenu.add(goToLineMenuItem);		editMenu.addSeparator();		//editMenu.add(selectAllMenuItem);//		editMenu.addSeparator();		editMenu.add(preferencesMenuItem);		editMenu.add(sortMenuItem);				menuBar.add(editMenu);				if (windowMenu != null)			menuBar.add(windowMenu);				final ActionMap map = tree.getActionMap();				JMenu navMenu = new JMenu("Navigation");				addNavItem(map, navMenu, "Expand", "expand", KeyEvent.VK_RIGHT );		addNavItem(map, navMenu, "Collapse", "collapse", KeyEvent.VK_LEFT);		addNavItem(map, navMenu, "Up", "selectPrevious", KeyEvent.VK_UP );		addNavItem(map, navMenu, "Down", "selectNext", KeyEvent.VK_DOWN);						menuBar.add(navMenu);				JMenu designationMenu = new JMenu("Designation");		int i = 0;		int keyEvents [] = {KeyEvent.VK_1, KeyEvent.VK_2, KeyEvent.VK_3, KeyEvent.VK_4, KeyEvent.VK_5, KeyEvent.VK_6, KeyEvent.VK_7, KeyEvent.VK_8, KeyEvent.VK_9};		for(String key :  I18N.instance().getUserDesignationKeys(true)) {			String name = I18N.instance().getUserDesignation(key);			addDesignationItem(designationMenu, name, keyEvents[i++]);		}		menuBar.add(designationMenu);						JMenu helpMenu = new JMenu("Help");		JMenuItem aboutItem = new JMenuItem("About FindBugs");		helpMenu.add(aboutItem);         aboutItem.addActionListener(new java.awt.event.ActionListener() {             public void actionPerformed(java.awt.event.ActionEvent evt) {                 about();             }         });         menuBar.add(helpMenu);		return menuBar;	}