本文整理匯總了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());
}