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


Java JMenu类代码示例

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


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

示例1: PopuleBarra

import javax.swing.JMenu; //导入依赖的package包/类
public void PopuleBarra(JMenu obj) {
    int i = 0;
    for (ConfigAcao ca : Lista) {
        if (ca.tipo == TipoConfigAcao.tpMenuBarra || ca.tipo == TipoConfigAcao.tpAny) {
            Acao ac = new Acao(editor, ca.texto, ca.ico, ca.descricao, ca.command);
            ac.IDX = i++;
            JMenuItem mi = new JMenuItem(ac);
            //obj.add(mi);
            listaMenus.put(ca.command, mi);
            //ListaDeAcoes.add(ac);
        }
    }
    obj.setText(Editor.fromConfiguracao.getValor("Controler.interface.menu.menuDiagrama.texto"));
    char b = Editor.fromConfiguracao.getValor("Controler.interface.menu.menuDiagrama.mtecla").charAt(0);
    obj.setMnemonic(b);
    BarraMenu = obj;
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:18,代码来源:Controler.java

示例2: addFoldingActionsToPopUpMenu

import javax.swing.JMenu; //导入依赖的package包/类
private void addFoldingActionsToPopUpMenu(JPopupMenu menu,
        List<TabAction> activeActions) {
    JMenu submenu = new JMenu(NbBundle.getMessage(
            OutputTab.class, "LBL_OutputFolds"));                   //NOI18N
    for (ACTION a : popUpFoldItems) {
        if (a == null) {
            submenu.addSeparator();
        } else {
            TabAction ta = action(a);
            activeActions.add(ta);
            submenu.add(new JMenuItem(ta));
        }
    }
    menu.addSeparator();
    menu.add(submenu);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:OutputTab.java

示例3: createPopupMenu

import javax.swing.JMenu; //导入依赖的package包/类
@Override
public JMenu createPopupMenu(Point atPoint) {
    MyJMenu result = new MyJMenu("Popup");
    switch (getGraphRole()) {
    case HOST:
        result.add(getActions().getApplyMatchAction());
        result.addSeparator();
        break;
    default:
        // do nothing
    }
    Action editAction;
    if (isForState()) {
        editAction = getActions().getEditStateAction();
    } else {
        editAction = getActions().getEditAction(ResourceKind.toResource(getGraphRole()));
    }
    result.add(editAction);
    result.addSubmenu(createEditMenu(atPoint));
    result.addSubmenu(super.createPopupMenu(atPoint));
    return result;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:23,代码来源:AspectJGraph.java

示例4: attachWorkspace

import javax.swing.JMenu; //导入依赖的package包/类
/** Initializes listeners atc to the given workspace */
void attachWorkspace(
    Workspace workspace, Workspace[] currentDeskRef, Hashtable workspace2Menu, Hashtable menu2Workspace,
    Hashtable workspace2Listener, JMenu menu
) {
    // bugfix #6116 - change from getName() to getDisplayName()
    JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem();
    Mnemonics.setLocalizedText(menuItem, workspace.getDisplayName());
    HelpCtx.setHelpIDString(menuItem, WorkspaceSwitchAction.class.getName());

    ActionListener listener = createActionListener(menuItem, currentDeskRef, menu2Workspace, workspace2Menu);
    menuItem.addActionListener(listener);
    menu2Workspace.put(listener, workspace);
    workspace2Listener.put(workspace, listener);
    workspace2Menu.put(workspace, menuItem);
    workspace.addPropertyChangeListener(createNameListener(menuItem));
    menu.add(menuItem);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:WorkspaceSwitchAction.java

示例5: buildGameMenu

import javax.swing.JMenu; //导入依赖的package包/类
private void buildGameMenu() {
    // --> Game
    JMenu menu = Utility.localizedMenu("menuBar.game");
    menu.setOpaque(false);
    menu.setMnemonic(KeyEvent.VK_G);

    menu.add(getMenuItem(NewAction.id));
    menu.add(getMenuItem(NewEmptyMapAction.id));

    menu.addSeparator();

    menu.add(getMenuItem(OpenAction.id));
    menu.add(getMenuItem(SaveAction.id));
    menu.add(getMenuItem(StartMapAction.id));

    menu.addSeparator();

    menu.add(getMenuItem(PreferencesAction.id));

    menu.addSeparator();

    menu.add(getMenuItem(ShowMainAction.id));
    menu.add(getMenuItem(QuitAction.id));

    add(menu);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:27,代码来源:MapEditorMenuBar.java

示例6: createWindowMenu

import javax.swing.JMenu; //导入依赖的package包/类
private JMenu createWindowMenu() {
    JMenu window = new JMenu("Window");
    window.setMnemonic('W');

    window.add(
            withMnemonics(
                    withEmptyIcon(
                            withShortCut(Utils.createMenuItem("Test Design", sActionListener))), 'T'));

    window.add(
            withMnemonics(
                    withShortCut(
                            Utils.createMenuItem("Test Execution", sActionListener)), 'E'));
    window.add(
            withMnemonics(
                    withShortCut(
                            Utils.createMenuItem("Dashboard", sActionListener)), 'D'));

    window.add(
            withMnemonics(
                    withShortCut(
                            Utils.createMenuItem("AdjustUI", sActionListener)), 'A'));

    return window;
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:26,代码来源:AppMenuBar.java

示例7: init

import javax.swing.JMenu; //导入依赖的package包/类
private void init() {
	JMenu pfMenu = new JMenu("Playfield graphics");
	JMenu help = new JMenu("Help");
	Settings settings = new Settings(UNDERLAY_NS);
	if (settings.contains("fileName")) {
		// create underlay image menu item only if filename is specified 
		enableBgImage = createCheckItem(pfMenu,"Show underlay image",false);
	}
	enableNodeName = createCheckItem(pfMenu, "Show node name string",true);
	enableNodeCoverage = createCheckItem(pfMenu, 
			"Show node radio coverage", true);
	enableNodeConnections = createCheckItem(pfMenu,
			"Show node's connections", true);
	enableMapGraphic = createCheckItem(pfMenu,"Show map graphic",true);
	autoClearOverlay = createCheckItem(pfMenu, "Autoclear overlay",true);
	clearOverlay = createMenuItem(pfMenu,"Clear overlays now");
	about = createMenuItem(help,"about");
	this.add(pfMenu);
	this.add(Box.createHorizontalGlue());
	this.add(help);
}
 
开发者ID:mdonnyk,项目名称:the-one-mdonnyk,代码行数:22,代码来源:SimMenuBar.java

示例8: setProjectMenuItems

import javax.swing.JMenu; //导入依赖的package包/类
/**
 * Create's the Window=>MenuItems depending on the open projects 
 */
private void setProjectMenuItems() {
	
	boolean setFontBold = true;
	
	JMenu WindowMenu = Application.getMainWindow().getJMenuMainWindow();
	WindowMenu.removeAll();
	if (this.count()==0 ){
		WindowMenu.add( new JMenuItmen_Window( Language.translate("Kein Projekt geöffnet !"), -1, setFontBold ) );
	} else {
		for(int i=0; i<this.count(); i++) {
			String ProjectName = this.getProjectsOpen().get(i).getProjectName();
			if ( ProjectName.equalsIgnoreCase( Application.getProjectFocused().getProjectName() ) ) 
				setFontBold = true;
			else 
				setFontBold = false;
			WindowMenu.add( new JMenuItmen_Window( ProjectName, i, setFontBold) );
		}		
	}
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:23,代码来源:ProjectsLoaded.java

示例9: 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

示例10: init

import javax.swing.JMenu; //导入依赖的package包/类
protected final void init() {
    add(addScenario = create("Add Scenario", Keystroke.NEW));
    add(renameScenario = create("Rename Scenario", Keystroke.RENAME));
    add(deleteScenario = create("Delete Scenario", Keystroke.DELETE));
    addSeparator();
    add(addTestCase = create("Add TestCase", Keystroke.NEW));
    add(renameTestCase = create("Rename TestCase", Keystroke.RENAME));
    add(deleteTestCase = create("Delete TestCase", Keystroke.DELETE));

    addSeparator();
    JMenu menu = new JMenu("Export As");
    menu.add(create("Manual Testcase", null));
    add(menu);
    add(toggleReusable = create("Make As Reusable/TestCase", null));
    toggleReusable.setText("Make As Reusable");
    addSeparator();
    setCCP();
    addSeparator();
    add(impactAnalysis = create("Get Impacted TestCases", null));
    add(getCmdSyntax = create("Get CmdLine Syntax", null));
    addSeparator();
    add(sort = create("Sort", null));
    addSeparator();
    add(create("Details", Keystroke.ALTENTER));
    sort.setIcon(Canvas.EmptyIcon);
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:27,代码来源:ProjectTree.java

示例11: getPopupMenuItem

import javax.swing.JMenu; //导入依赖的package包/类
public @Override JMenuItem getPopupMenuItem(JTextComponent target) {
    String menuText = org.openide.util.NbBundle.getBundle (NbEditorKit.class).
        getString("Menu/View/CodeFolds");
    JMenu menu = new JMenu(menuText);
    Mnemonics.setLocalizedText(menu, menuText);
    setAddSeparatorBeforeNextAction(false);
    addAction(target, menu, BaseKit.collapseFoldAction);
    addAction(target, menu, BaseKit.expandFoldAction);
    setAddSeparatorBeforeNextAction(true);
    addAction(target, menu, BaseKit.collapseAllFoldsAction);
    addAction(target, menu, BaseKit.expandAllFoldsAction);
    // this is a hack, which assumes a certain action name from editor.fold.ui
    // if the action does not exist, nothing will be added to the menu.
    addAction(target, menu, "collapse-fold-tree"); // NOI18N
    addAction(target, menu, "expand-fold-tree"); // NOI18N
    // By default add separator before next actions (can be overriden if unwanted)
    setAddSeparatorBeforeNextAction(true);
    if (target != null) addAdditionalItems(target, menu);
    return menu;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:NbEditorKit.java

示例12: KMeanScatterPopupMenu

import javax.swing.JMenu; //导入依赖的package包/类
public KMeanScatterPopupMenu() {
	restore = new JMenuItem("Original view");
	saveAs = new JMenuItem("Save as...");
	clusters = new JMenu("Cluster");
	printClusterInfo = new JMenuItem("Save info...");
	point = new JMenu("Point size");
	for (int i = 0; i < 3; i++) {
		JMenuItem m = new JMenuItem();
		m.setAction(commonActionSize);
		m.setText("Size " + Integer.toString((i + 1)));
		point.add(m);
	}
	this.add(restore);
	this.addSeparator();
	this.add(point);
	this.addSeparator();
	this.add(saveAs);
	this.addSeparator();
	this.add(printClusterInfo);
	this.addSeparator();
	this.add(clusters);
	addListeners();

}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:25,代码来源:FuzzyKSingleClusterScatter.java

示例13: getPopupPresenter

import javax.swing.JMenu; //导入依赖的package包/类
public JMenuItem getPopupPresenter() {
    JMenu displayAsPopup = new JMenu();
    Mnemonics.setLocalizedText(displayAsPopup, NbBundle.getMessage(DebuggingActionsProvider.class, "CTL_Session_Popup_Language"));

    String [] languages = session.getSupportedLanguages();
    String currentLanguage = session.getCurrentLanguage();
    for (int i = 0; i < languages.length; i++) {
        final String language = languages[i];
        JRadioButtonMenuItem langItem = new JRadioButtonMenuItem(new AbstractAction(language) {
            public void actionPerformed(ActionEvent e) {
                session.setCurrentLanguage(language);
            }
        });
        if (currentLanguage.equals(language)) langItem.setSelected(true);
        displayAsPopup.add(langItem);
    }
    return displayAsPopup;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:DebuggingActionsProvider.java

示例14: addFoldTypes

import javax.swing.JMenu; //导入依赖的package包/类
private void addFoldTypes (JTextComponent target, JMenu menu, Language language, Set expands) {
    List<Feature> features = language.getFeatureList ().getFeatures (LanguagesFoldManager.FOLD);
    Iterator<Feature> it = features.iterator ();
    while (it.hasNext ()) {
        Feature fold = it.next ();
        String expand = LocalizationSupport.localize (language, (String) fold.getValue ("expand_type_action_name"));
        if (expand == null) continue;
        if (expands.contains (expand))
            continue;
        expands.add (expand);
        String collapse = LocalizationSupport.localize (language, (String) fold.getValue ("collapse_type_action_name"));
        if (collapse == null) continue;
        addAction (target, menu, EXPAND_PREFIX + expand);
        addAction (target, menu, COLLAPSE_PREFIX + collapse);
        setAddSeparatorBeforeNextAction (true);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:LanguagesGenerateFoldPopupAction.java

示例15: KMeanScatterPopupMenu

import javax.swing.JMenu; //导入依赖的package包/类
public KMeanScatterPopupMenu() {
	restore = new JMenuItem("Original view");
	saveAs = new JMenuItem("Save as...");
	//clusters = new JMenu("Clusters");
	printClusterInfo = new JMenuItem("Save info...");
	point = new JMenu("Point size");
	for (int i = 0; i < 5; i++) {
		JMenuItem m = new JMenuItem();
		m.setAction(commonActionSize);
		m.setText("Size " + Integer.toString((i + 1)));
		point.add(m);
	}
	this.add(restore);
	this.addSeparator();
	this.add(point);
	this.addSeparator();
	this.add(saveAs);
	this.addSeparator();
	this.add(printClusterInfo);
	//this.addSeparator();
	//this.add(clusters);
	addListeners();

}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:25,代码来源:KFuzzyScatter.java


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