當前位置: 首頁>>代碼示例>>Java>>正文


Java JMenu.addMenuListener方法代碼示例

本文整理匯總了Java中javax.swing.JMenu.addMenuListener方法的典型用法代碼示例。如果您正苦於以下問題:Java JMenu.addMenuListener方法的具體用法?Java JMenu.addMenuListener怎麽用?Java JMenu.addMenuListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JMenu的用法示例。


在下文中一共展示了JMenu.addMenuListener方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createMainMenuBar

import javax.swing.JMenu; //導入方法依賴的package包/類
public static JMenuBar createMainMenuBar(List<XML_Menu> menuLayers) {
	JMenuBar mainMenuBar = new JMenuBar();
	for (XML_Menu sub_menu : menuLayers) {
		if ( mapApp.start != null ) {
			mapApp.start.setText("Initializing " + sub_menu.name + " Menu...");
		}
		if ( sub_menu.proj.toLowerCase().indexOf(MapApp.CURRENT_PROJECTION.toLowerCase()) != -1 ) {
			JMenu subMenu = createMenu(sub_menu);
			if (subMenu.getItemCount() != 0)
				mainMenuBar.add(subMenu);
				subMenu.addMenuListener(mapApp.listener);
		}
	}
	if ( mapApp != null && mapApp.start != null ) {
		mapApp.start.setText("Initializing GUI");
	}
	return mainMenuBar;
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:19,代碼來源:XML_Menu.java

示例2: getPopupMenu

import javax.swing.JMenu; //導入方法依賴的package包/類
@Override
public JPopupMenu getPopupMenu(Widget widget, Point point) {
    JPopupMenu menu = diagramScene.createPopupMenu();
    menu.addSeparator();

    JMenu predecessors = new JMenu("Nodes Above");
    predecessors.addMenuListener(new NeighborMenuListener(predecessors, getFigure(), false));
    menu.add(predecessors);

    JMenu successors = new JMenu("Nodes Below");
    successors.addMenuListener(new NeighborMenuListener(successors, getFigure(), true));
    menu.add(successors);

    return menu;
}
 
開發者ID:arodchen,項目名稱:MaxSim,代碼行數:16,代碼來源:FigureWidget.java

示例3: menuSelected

import javax.swing.JMenu; //導入方法依賴的package包/類
@Override
public void menuSelected(MenuEvent e) {
    if (menu.getItemCount() > 0) {
        // already built before
        return;
    }

    Set<Figure> set = figure.getPredecessorSet();
    if (successors) {
        set = figure.getSuccessorSet();
    }

    boolean first = true;
    for (Figure f : set) {
        if (f == figure) {
            continue;
        }

        if (first) {
            first = false;
        } else {
            menu.addSeparator();
        }

        Action go = diagramScene.createGotoAction(f);
        menu.add(go);

        JMenu preds = new JMenu("Nodes Above");
        preds.addMenuListener(new NeighborMenuListener(preds, f, false));
        menu.add(preds);

        JMenu succs = new JMenu("Nodes Below");
        succs.addMenuListener(new NeighborMenuListener(succs, f, true));
        menu.add(succs);
    }

    if (menu.getItemCount() == 0) {
        menu.add("(none)");
    }
}
 
開發者ID:arodchen,項目名稱:MaxSim,代碼行數:41,代碼來源:FigureWidget.java

示例4: build

import javax.swing.JMenu; //導入方法依賴的package包/類
public static void build(JPopupMenu menu, Figure figure, FigureWidget figureWidget, boolean successors, DiagramScene diagramScene) {
    Set<Figure> set = figure.getPredecessorSet();
    if (successors) {
        set = figure.getSuccessorSet();
    }

    boolean first = true;
    for (Figure f : set) {
        if (f == figure) {
            continue;
        }

        if (first) {
            first = false;
        } else {
            menu.addSeparator();
        }

        Action go = diagramScene.createGotoAction(f);
        menu.add(go);

        JMenu preds = new JMenu("Nodes Above");
        preds.addMenuListener(figureWidget.new NeighborMenuListener(preds, f, false));
        menu.add(preds);

        JMenu succs = new JMenu("Nodes Below");
        succs.addMenuListener(figureWidget.new NeighborMenuListener(succs, f, true));
        menu.add(succs);
    }

    if (figure.getPredecessorSet().isEmpty() && figure.getSuccessorSet().isEmpty()) {
        menu.add("(none)");
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:35,代碼來源:FigureWidget.java

示例5: createMainMenuBars

import javax.swing.JMenu; //導入方法依賴的package包/類
public static JMenuBar createMainMenuBars(List<XML_Menu> menuLayers, List<XML_Menu> menuLayersLocal) {
	JMenuBar mainMenuBar = new JMenuBar();
	for (XML_Menu sub_menu : menuLayers) {
		if ( mapApp.start != null ) {
			mapApp.start.setText("Initializing " + sub_menu.name + " Menu...");
		}
		if ( sub_menu.proj.toLowerCase().indexOf(MapApp.CURRENT_PROJECTION.toLowerCase()) != -1 ) {
			JMenu subMenu = createMenu(sub_menu);
			if (subMenu.getItemCount() != 0)
				mainMenuBar.add(subMenu);
				subMenu.addMenuListener(mapApp.listener);
		}
	}
	// Add My Sessions Menu
	for (XML_Menu sub_menu2 : menuLayersLocal) {
		if ( mapApp.start != null ) {
			mapApp.start.setText("Initializing " + sub_menu2.name + " Menu...");
		}
		if ( sub_menu2.proj.toLowerCase().indexOf(MapApp.CURRENT_PROJECTION.toLowerCase()) != -1 ) {
			JMenu subMenu2 = createMenu(sub_menu2);
			if (subMenu2.getItemCount() != 0)
				mainMenuBar.add(subMenu2);
				subMenu2.addMenuListener(mapApp.listener);
		}
	}

	if ( mapApp != null && mapApp.start != null ) {
		mapApp.start.setText("Initializing GUI");
	}
	return mainMenuBar;
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:32,代碼來源:XML_Menu.java

示例6: attachToMenu

import javax.swing.JMenu; //導入方法依賴的package包/類
private void attachToMenu (JMenu menu) {
    menu.addContainerListener(getMenuListener());
    menu.addComponentListener(getMenuListener());
    menu.addMenuListener(getMenuListener());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:AbstractMenuFactory.java


注:本文中的javax.swing.JMenu.addMenuListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。