本文整理汇总了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;
}
示例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;
}
示例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)");
}
}
示例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)");
}
}
示例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;
}
示例6: attachToMenu
import javax.swing.JMenu; //导入方法依赖的package包/类
private void attachToMenu (JMenu menu) {
menu.addContainerListener(getMenuListener());
menu.addComponentListener(getMenuListener());
menu.addMenuListener(getMenuListener());
}