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


Java JMenu.removeAll方法代码示例

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


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

示例1: createBindingsSubmenu

import javax.swing.JMenu; //导入方法依赖的package包/类
private void createBindingsSubmenu(JMenu menu) {
    if (menu.getMenuComponentCount() > 0)
        menu.removeAll();

    Node[] nodes = getActivatedNodes();
    if (nodes.length != 1)
        return;

    RADComponentCookie radCookie = nodes[0].getCookie(RADComponentCookie.class);
    if (radCookie == null)
        return;

    BindingProperty[][] bindingProps = radCookie.getRADComponent().getBindingProperties();
    BindingProperty[] props = bindingProps[(bindingProps[0].length==0) ? 1 : 0];
    if (props.length > 0) {
        for (BindingProperty prop : props) {
            BindingMenuItem mi = new BindingMenuItem(prop);
            mi.addActionListener(mi);
            menu.add(mi);
        }
    } else {
        JMenuItem item = new JMenuItem(NbBundle.getMessage(BindAction.class, "MSG_NoBinding")); // NOI18N
        item.setEnabled(false);
        menu.add(item);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:BindAction.java

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

示例3: updateMenu

import javax.swing.JMenu; //导入方法依赖的package包/类
/**
 * Add list orecentProjFile recent projects as Menu Items to the Recent
 * projects menu
 *
 *
 * @param recentProj instance orecentProjFile the menu to address
 * <code>Recent Projects</code>
 */
public void updateMenu(JMenu recentProj) {
    recentProj.removeAll();
    try {
        for (String file : recentProjects) {
            recentItemMenu = new JMenuItem();
            recentItemMenu.setFont(new java.awt.Font("sansserif", 0, 11));
            recentItemMenu.setText(toName(file));
            recentItemMenu.setToolTipText(file);
            recentProj.add(recentItemMenu);
            addlistener(recentItemMenu);
        }
    } catch (Exception ex) {
        Logger.getLogger(RecentItems.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:24,代码来源:RecentItems.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: menuDeselected

import javax.swing.JMenu; //导入方法依赖的package包/类
public void menuDeselected(MenuEvent e) {
	JMenu wm = (JMenu) e.getSource();

	// Cleans Windows if not visible
	if(wm.getText().matches("Windows") || wm.getText().matches("Window")) {
	wm.removeAll();
	System.gc();
	}

	/* When user first imports menu item the background is set to another color to catch user attention.
	 * After user interaction will set the background color back.
	 */
	if(wm.getText().matches("My Layer Sessions")) {
		JMenu selectSessionMenu = (JMenu) wm;
		try {
			JMenuItem selectSessionMenuChild = (JMenuItem) selectSessionMenu.getMenuComponent(0);
			Color currentColor = selectSessionMenu.getBackground();
			Color defaultColor = selectSessionMenuChild.getBackground();
			if(currentColor.getRed() + currentColor.getGreen() + currentColor.getBlue() == 586) {
				selectSessionMenu.setBackground(defaultColor);
				selectSessionMenu.revalidate();	
		}
		} catch (Exception ex) {
			//don't do anything if menu component and cannot be cast as a JMenuItem 
			//(eg if it is a separator bar)
		}
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:29,代码来源:MapApp.java

示例6: fillSubMenu

import javax.swing.JMenu; //导入方法依赖的package包/类
@Messages({
    "LBL_NewFileAction_File_PopupName=Other...",
    "NewFile.please_wait=Please wait..."
})
private void fillSubMenu(final JMenu menuItem, final Lookup lookup) {
    menuItem.removeAll();
    JMenuItem wait = new JMenuItem(NewFile_please_wait());
    wait.setEnabled(false);
    menuItem.add(wait);
    final Pair<List<Project>, List<FileObject>> data = ActionsUtil.mineFromLookup(lookup);
    RP.post(new Runnable() {
        @Override public void run() {
            Project projects[] = ActionsUtil.getProjects(data);
            final Project project = projects.length > 0 ? projects[0] : null;
            final List<TemplateItem> items = OpenProjectList.prepareTemplates(project, getLookup());
            EventQueue.invokeLater(new Runnable() {
                @Override public void run() {
                    menuItem.removeAll();
                    ActionListener menuListener = new PopupListener();
                    for (TemplateItem i : items) {
                        JMenuItem item = new JMenuItem(
                                LBL_NewFileAction_Template_PopupName(i.displayName),
                                i.icon);
                        item.addActionListener(menuListener);
                        item.putClientProperty(TEMPLATE_PROPERTY, i.template);
                        item.putClientProperty(IN_PROJECT_PROPERTY, project != null);
                        menuItem.add(item);
                    }
                    if (!items.isEmpty()) {
                        menuItem.add(new Separator());
                    }
                    JMenuItem fileItem = new JMenuItem(LBL_NewFileAction_File_PopupName(), (Icon) getValue(Action.SMALL_ICON));
                    fileItem.addActionListener(menuListener);
                    fileItem.putClientProperty(TEMPLATE_PROPERTY, null);
                    fileItem.putClientProperty(IN_PROJECT_PROPERTY, project != null);
                    menuItem.add(fileItem);
                    // #205616 - need to refresh please wait node
                    menuItem.getPopupMenu().pack();
                }
            });
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:44,代码来源:NewFile.java

示例7: depopulateMenu

import javax.swing.JMenu; //导入方法依赖的package包/类
protected void depopulateMenu (String containerCtx, JMenu menu) {
    menu.removeAll();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:AbstractMenuFactory.java


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