当前位置: 首页>>代码示例>>Java>>正文


Java JMenu.setEnabled方法代码示例

本文整理汇总了Java中javax.swing.JMenu.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java JMenu.setEnabled方法的具体用法?Java JMenu.setEnabled怎么用?Java JMenu.setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JMenu的用法示例。


在下文中一共展示了JMenu.setEnabled方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createJdkSubmenu

import javax.swing.JMenu; //导入方法依赖的package包/类
@Messages("ActionMappings.jdkVar=Use JDK for Maven build")
private static JMenu createJdkSubmenu(JTextComponent area) {
    JMenu menu = new JMenu();
    menu.setText(ActionMappings_jdkVar());
    boolean hasAny = false;
    for (JavaPlatform platform : JavaPlatformManager.getDefault().getInstalledPlatforms()) {
        hasAny = true;
        if (platform.getInstallFolders().size() > 0) {
            menu.add(new JdkAction(area, platform.getDisplayName(), platform.getInstallFolders().iterator().next()));
        }
    }
    if (!hasAny) {
        menu.setEnabled(false);
    }
    return menu;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ActionMappings.java

示例2: mouseClicked

import javax.swing.JMenu; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent e) {
	
	FenetreGestionDeProjet fenetre = FenetreGestionDeProjet.getInstance();
	
	// TODO Auto-generated method stub
	if (e.getButton() == MouseEvent.BUTTON3) {
		//System.out.println("modification et suppression");
		JMenu contextMenu = new JMenu();
		JMenuItem modifie = new JMenuItem("Modifier");
		JMenuItem supprime = new JMenuItem("Supprimer");
		contextMenu.add(modifie);
		contextMenu.add(supprime);
		contextMenu.setMenuLocation(e.getX(),e.getY());
		
		fenetre.add(contextMenu);

		contextMenu.setEnabled(true);
		contextMenu.setVisible(true);
		
		contextMenu.setPopupMenuVisible(true);
	}
}
 
开发者ID:TeamLDCCIIT,项目名称:Java_GestionProjet,代码行数:24,代码来源:ActionClickDroit.java

示例3: createAnimationMenu

import javax.swing.JMenu; //导入方法依赖的package包/类
private void createAnimationMenu() {
	animationMenu = new JMenu("Animation");
	animationMenu.setMnemonic(KeyEvent.VK_A);
	fileMenu.getAccessibleContext().setAccessibleDescription(
			"Manage the animation.");
	menuBar.add(animationMenu);
	animationMenu.setEnabled(false);

	initialiseItem = new JMenuItem("Initialise");
	initialiseItem.setMnemonic(KeyEvent.VK_I);
	initialiseItem.addActionListener(menuListener);
	animationMenu.add(initialiseItem);

	playPauseItem = new JMenuItem("Play");
	playPauseItem.setMnemonic(KeyEvent.VK_P);
	playPauseItem.addActionListener(menuListener);
	animationMenu.add(playPauseItem);

	stopItem = new JMenuItem("Stop");
	stopItem.setMnemonic(KeyEvent.VK_T);
	stopItem.addActionListener(menuListener);
	stopItem.setEnabled(false);
	animationMenu.add(stopItem);
}
 
开发者ID:moment-of-peace,项目名称:AI-RRT-Motion-Planning,代码行数:25,代码来源:Visualiser.java

示例4: recreateStateMenu

import javax.swing.JMenu; //导入方法依赖的package包/类
private void recreateStateMenu(JMenu menu, ArrayList<CircuitStateMenuItem> items, int code) {
	menu.removeAll();
	menu.setEnabled(items.size() > 0);
	boolean first = true;
	int mask = getToolkit().getMenuShortcutKeyMask();
	for (int i = items.size() - 1; i >= 0; i--) {
		JMenuItem item = items.get(i);
		menu.add(item);
		if (first) {
			item.setAccelerator(KeyStroke.getKeyStroke(code, mask));
			first = false;
		} else {
			item.setAccelerator(null);
		}
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:17,代码来源:MenuSimulate.java

示例5: enableMenu

import javax.swing.JMenu; //导入方法依赖的package包/类
protected static void enableMenu (JMenu menu) {
    boolean enabled = false;
    for (int i = 0; i < menu.getItemCount(); ++i) {
        JMenuItem item = menu.getItem(i);
        if (item != null && item.isEnabled()) {
            enabled = true;
            break;
        }
    }
    menu.setEnabled(enabled);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:DynamicMenu.java

示例6: createGlobalVarSubmenu

import javax.swing.JMenu; //导入方法依赖的package包/类
@Messages("ActionMappings.globalVar=Reference IDE Global Variable")
private static JMenu createGlobalVarSubmenu(JTextComponent area) {
    JMenu menu = new JMenu();
    menu.setText(ActionMappings_globalVar());
    Map<String, String> vars = DefaultReplaceTokenProvider.readVariables();
    boolean hasAny = false;
    for (Map.Entry<String, String> ent : vars.entrySet()) {
        hasAny = true;
        menu.add(new UseGlobalVarAction(area, ent.getKey()));
    }
    if (!hasAny) {
        menu.setEnabled(false);
    }
    return menu;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ActionMappings.java

示例7: enableMenu

import javax.swing.JMenu; //导入方法依赖的package包/类
private void enableMenu (JMenu menu) {
    boolean enabled = false;
    for (int i = 0; i < menu.getItemCount(); ++i) {
        JMenuItem item = menu.getItem(i);
        if (item != null && item.isEnabled()) {
            enabled = true;
            break;
        }
    }
    menu.setEnabled(enabled);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:ShelveChangesMenu.java

示例8: doRefreshFile

import javax.swing.JMenu; //导入方法依赖的package包/类
/** This method refreshes the "file" menu. */
private Runner doRefreshFile() {
    if (wrap) return wrapMe();
    try {
        wrap = true;
        filemenu.removeAll();
        menuItem(filemenu, "New",     'N', 'N', doNew());
        menuItem(filemenu, "Open...", 'O', 'O', doOpen());
        if (!Util.onMac())
           menuItem(filemenu, "Open Sample Models...", VK_ALT, 'O', doBuiltin());
        else
           menuItem(filemenu, "Open Sample Models...", doBuiltin());
        JMenu recentmenu;
        filemenu.add(recentmenu = new JMenu("Open Recent"));
        menuItem(filemenu, "Reload all", 'R', 'R', doReloadAll());
        menuItem(filemenu, "Save",       'S', 'S', doSave());
        if (Util.onMac())
           menuItem(filemenu, "Save As...", VK_SHIFT, 'S', doSaveAs());
        else
           menuItem(filemenu, "Save As...", 'A', doSaveAs());
        menuItem(filemenu, "Close",                     'W', 'W',                         doClose());
        menuItem(filemenu, "Clear Temporary Directory",                                   doClearTemp());
        menuItem(filemenu, "Quit",                      'Q', (Util.onMac() ? -1 : 'Q'), doQuit());
        boolean found = false;
        for(Util.StringPref p: new Util.StringPref[]{ Model0, Model1, Model2, Model3 }) {
            String name = p.get();
            if (name.length()>0) { found = true; menuItem(recentmenu, name, doOpenFile(name)); }
        }
        recentmenu.addSeparator();
        menuItem(recentmenu, "Clear Menu", doClearRecent());
        recentmenu.setEnabled(found);
    } finally {
        wrap = false;
    }
    return null;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:37,代码来源:SimpleGUI.java

示例9: FloatingTabbedPane

import javax.swing.JMenu; //导入方法依赖的package包/类
public FloatingTabbedPane() {
	hiddenMenu = new JMenu("Hidden Panels");
	hiddenMenu.setEnabled(false);
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:5,代码来源:FloatingTabbedPane.java

示例10: doRefreshFile

import javax.swing.JMenu; //导入方法依赖的package包/类
/** This method refreshes the "file" menu. */
private Runner doRefreshFile() {
	if (wrap)
		return wrapMe();
	try {
		wrap = true;
		filemenu.removeAll();
		menuItem(filemenu, "New", 'N', 'N', doNew());
		menuItem(filemenu, "Open...", 'O', 'O', doOpen());
		if (!Util.onMac())
			menuItem(filemenu, "Open Sample Models...", VK_ALT, 'O', doBuiltin());
		else
			menuItem(filemenu, "Open Sample Models...", doBuiltin());
		JMenu recentmenu;
		filemenu.add(recentmenu = new JMenu("Open Recent"));
		menuItem(filemenu, "Reload all", 'R', 'R', doReloadAll());
		menuItem(filemenu, "Save", 'S', 'S', doSave());
		if (Util.onMac())
			menuItem(filemenu, "Save As...", VK_SHIFT, 'S', doSaveAs());
		else
			menuItem(filemenu, "Save As...", 'A', doSaveAs());
		menuItem(filemenu, "Close", 'W', 'W', doClose());
		menuItem(filemenu, "Clear Temporary Directory", doClearTemp());
		menuItem(filemenu, "Quit", 'Q', (Util.onMac() ? -1 : 'Q'), doQuit());
		boolean found = false;
		for (StringPref p : new StringPref[] {
				Model0, Model1, Model2, Model3
		}) {
			String name = p.get();
			if (name.length() > 0) {
				found = true;
				menuItem(recentmenu, name, doOpenFile(name));
			}
		}
		recentmenu.addSeparator();
		menuItem(recentmenu, "Clear Menu", doClearRecent());
		recentmenu.setEnabled(found);
	} finally {
		wrap = false;
	}
	return null;
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:43,代码来源:SimpleGUI.java

示例11: doRefreshOption

import javax.swing.JMenu; //导入方法依赖的package包/类
/** This method refreshes the "Option" menu. */
private Runner doRefreshOption() {
	if (wrap)
		return wrapMe();
	try {
		wrap = true;
		optmenu.removeAll();
		addToMenu(optmenu, Welcome);

		optmenu.addSeparator();

		addToMenu(optmenu, WarningNonfatal);
		addToMenu(optmenu, SubMemory, SubStack, VerbosityPref);

		optmenu.addSeparator();

		addToMenu(optmenu, SyntaxDisabled);
		addToMenu(optmenu, FontSize);
		menuItem(optmenu, "Font: " + FontName.get() + "...", doOptFontname());
		addToMenu(optmenu, TabSize);
		if (Util.onMac() || Util.onWindows())
			menuItem(optmenu, "Use anti-aliasing: Yes", false);
		else
			addToMenu(optmenu, AntiAlias);
		addToMenu(optmenu, A4Preferences.LAF);

		optmenu.addSeparator();

		addToMenu(optmenu, Solver);
		addToMenu(optmenu, SkolemDepth);
		JMenu cmMenu = addToMenu(optmenu, CoreMinimization);
		cmMenu.setEnabled(Solver.get() == SatSolver.MiniSatProverJNI);
		JMenu cgMenu = addToMenu(optmenu, CoreGranularity);
		cgMenu.setEnabled(Solver.get() == SatSolver.MiniSatProverJNI);

		addToMenu(optmenu, AutoVisualize, RecordKodkod);

		if (Version.experimental) {
			addToMenu(optmenu, Unrolls);
			addToMenu(optmenu, ImplicitThis, NoOverflow, InferPartialInstance);
		}

	} finally {
		wrap = false;
	}
	return null;
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:48,代码来源:SimpleGUI.java

示例12: buildFileMenu

import javax.swing.JMenu; //导入方法依赖的package包/类
private void buildFileMenu() {
	setFileMenu(new JMenu());
	fileMenu.setMnemonic(KeyEvent.VK_F);
	
	newDatabase = new JMenuItem("New Database");
	newDatabase.setMnemonic(KeyEvent.VK_N);
	
	openDatabase = new JMenuItem("Open...");
	openDatabase.setMnemonic(KeyEvent.VK_O);
	
	saveDatabase = new JMenuItem("Save");
	saveDatabase.setMnemonic(KeyEvent.VK_S);
	
	saveDatabaseAs = new JMenuItem("Save As...");
	
	importOption = new JMenu("Import");
	importRelAlgQuery = new JMenuItem("Relational Algebra Query");
	importOption.add(importRelAlgQuery);
	
	exportOption = new JMenu("Export");
	exportRelAlgQuery = new JMenuItem("Relational Algebra Query");
	exportSqlQuery = new JMenuItem("SQL Query");
	exportParseTree = new JMenuItem("Parse Tree (.png)");
	exportQueryResultTable = new JMenuItem("Result Table (.csv)");
	exportOption.add(exportRelAlgQuery);
	exportOption.add(exportSqlQuery);
	exportOption.add(exportParseTree);
	exportOption.add(exportQueryResultTable);
	
	exitOption = new JMenuItem("Exit");
	
	//getFileMenu().add(newDatabase);
	getFileMenu().add(openDatabase);
	getFileMenu().add(new JSeparator());
	getFileMenu().add(saveDatabase);
	getFileMenu().add(saveDatabaseAs);
	getFileMenu().add(new JSeparator());
	getFileMenu().add(importOption);
	getFileMenu().add(exportOption);
	getFileMenu().add(new JSeparator());
	getFileMenu().add(exitOption);
	
	saveDatabase.setEnabled(false);
	saveDatabaseAs.setEnabled(false);
	importOption.setEnabled(false);
	exportOption.setEnabled(false);
	
	KeyStroke ctrlN = KeyStroke.getKeyStroke(
			KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
	KeyStroke ctrlO = KeyStroke.getKeyStroke(
			KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
	KeyStroke ctrlS = KeyStroke.getKeyStroke(
			KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
	
	newDatabase.setAccelerator(ctrlN);
	openDatabase.setAccelerator(ctrlO);
	saveDatabase.setAccelerator(ctrlS);
}
 
开发者ID:tteguayco,项目名称:JITRAX,代码行数:59,代码来源:MenuBar.java

示例13: createMenu

import javax.swing.JMenu; //导入方法依赖的package包/类
public static JMenu createMenu(XML_Menu menuLayer) {
	JMenu menu = new JMenu(menuLayer.name);
	menuToMenuItem.put(menuLayer, menu);

	boolean isEnabled = false;

	for (XML_Menu sub_menu : menuLayer.child_layers) {
		if (sub_menu.proj != null) {
			//Don't do for imported sessions as we are now adding all sessions to the menu, and will
			//switch projection when loading.
			if ( !(menuLayer.parent != null && menuLayer.parent.name.equals("My Layer Sessions")) &&
					!menuLayer.name.equals("My Layer Sessions") &&
					!sub_menu.proj.toLowerCase().contains(MapApp.CURRENT_PROJECTION.toLowerCase())) {
				if ( sub_menu.separator_bar != null )
					menu.addSeparator();
				continue;
			}
		}
		if (sub_menu.os != null)
			if (!current_os.toLowerCase().contains(sub_menu.os.toLowerCase()))
				continue;

		if ( sub_menu.child_layers.size() > 0 ) {
			JMenu subMenu = createMenu(sub_menu);
			if (subMenu.getItemCount() != 0)
				menu.add(subMenu);

			isEnabled = isEnabled || subMenu.isEnabled();
		}
		else {
			JMenuItem mi = createMenuItem(sub_menu);

			isEnabled = isEnabled || mi.isEnabled();

			if ( sub_menu.separator_bar != null ) {
				if ( sub_menu.separator_bar.equals("above")) {
					menu.addSeparator();
					menu.add(mi);
				}
				else {
					menu.add(mi);
					menu.addSeparator();
				}
			}
			else {
				menu.add(mi);
			}
		}
	}

	if ("true".equalsIgnoreCase(menuLayer.isRemote) && MapApp.AT_SEA)
		menu.setEnabled(false);
	else
		menu.setEnabled(isEnabled);

	return menu;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:58,代码来源:XML_Menu.java


注:本文中的javax.swing.JMenu.setEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。