java.awt.Menu.addActionListener()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(169)

本文整理了Java中java.awt.Menu.addActionListener()方法的一些代码示例,展示了Menu.addActionListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Menu.addActionListener()方法的具体详情如下:
包路径:java.awt.Menu
类名称:Menu
方法名:addActionListener

暂无

代码示例

代码示例来源:origin: net.imagej/ij

public int install(String text) {
  if (text==null && pgm==null)
    return 0;
  this.text = text;
  macrosMenu = Menus.getMacrosMenu();
  if (listener!=null)
    macrosMenu.removeActionListener(listener);
  macrosMenu.addActionListener(this);
  listener = this;
  install();
  return nShortcuts;
}

代码示例来源:origin: imagej/ImageJA

public int install(String text) {
  if (text==null && pgm==null)
    return 0;
  this.text = text;
  macrosMenu = Menus.getMacrosMenu();
  if (listener!=null)
    macrosMenu.removeActionListener(listener);
  macrosMenu.addActionListener(this);
  listener = this;
  install();
  return nShortcuts;
}

代码示例来源:origin: mikera/tyrant

private Menu createMenu(String menuName, String[] names, Action[] actions, boolean[] separatorsBetweenItems) {
  final java.util.Map<String, Action> menuToAction = new HashMap<>();
  associateNamesAndActions(menuToAction, names, actions);
  Menu menu = new Menu(menuName);
  for (int i = 0; i < names.length; i++) {
    String name = names[i];
    menu.add(name);
    if(i < separatorsBetweenItems.length) {
      if(separatorsBetweenItems[i]) {
        menu.addSeparator();
      }
    }
  }
  menu.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      Action action = menuToAction.get(e.getActionCommand());
      if(action == null) return;
      actionHandler.handleAction(null, action, false);
    }
  });
  return menu;
}

代码示例来源:origin: net.imagej/ij

subMenu = new Menu(parentStr);
subMenu.setName(parentStr);
subMenu.addActionListener(this);
subMenus.add(subMenu);
parent.add(subMenu);

代码示例来源:origin: org.w3c.jigsaw/jigsaw

String major = (String)e.nextElement();
Menu imenu = new Menu(major);
imenu.addActionListener(this);
minor = (String[]) mimeTypes.get(major);
for(int i=0; i<minor.length; i++) {

代码示例来源:origin: imagej/ImageJA

subMenu = new Menu(parentStr);
subMenu.setName(parentStr);
subMenu.addActionListener(this);
subMenus.add(subMenu);
parent.add(subMenu);

代码示例来源:origin: net.imagej/ij

macrosMenu.addSeparator();
macrosMenu.addActionListener(this);
mb.add(macrosMenu);
if (!(name.endsWith(".js")||name.endsWith(".bsh")||name.endsWith(".py"))) {
  debugMenu.add(new MenuItem("Run to Insertion Point", new MenuShortcut(KeyEvent.VK_E, true)));
  debugMenu.add(new MenuItem("Abort"));
  debugMenu.addActionListener(this);
  mb.add(debugMenu);

代码示例来源:origin: imagej/ImageJA

macrosMenu.addSeparator();
macrosMenu.addActionListener(this);
mb.add(macrosMenu);
if (!(name.endsWith(".js")||name.endsWith(".bsh")||name.endsWith(".py"))) {
  debugMenu.add(new MenuItem("Run to Insertion Point", new MenuShortcut(KeyEvent.VK_E, true)));
  debugMenu.add(new MenuItem("Abort"));
  debugMenu.addActionListener(this);
  mb.add(debugMenu);

代码示例来源:origin: net.imagej/ij

m.add(new MenuItem("Duplicate..."));
m.addActionListener(this);
mb.add(m);
textPanel.fileMenu = m;
m.add(new MenuItem("Find...", new MenuShortcut(KeyEvent.VK_F)));
m.add(new MenuItem("Find Next", new MenuShortcut(KeyEvent.VK_G)));
m.addActionListener(this);
mb.add(m);
textPanel.editMenu = m;
m.add(antialiased);
m.add(new MenuItem("Save Settings"));
m.addActionListener(this);
mb.add(m);
if (getTitle().equals("Results")) {
  m.add(new MenuItem("Plot..."));
  m.add(new MenuItem("Options..."));
  m.addActionListener(this);
  mb.add(m);

代码示例来源:origin: imagej/ImageJA

m.add(new MenuItem("Duplicate..."));
m.addActionListener(this);
mb.add(m);
textPanel.fileMenu = m;
m.add(new MenuItem("Find...", new MenuShortcut(KeyEvent.VK_F)));
m.add(new MenuItem("Find Next", new MenuShortcut(KeyEvent.VK_G)));
m.addActionListener(this);
mb.add(m);
textPanel.editMenu = m;
m.add(antialiased);
m.add(new MenuItem("Save Settings"));
m.addActionListener(this);
mb.add(m);
if (getTitle().equals("Results")) {
  m.add(new MenuItem("Plot..."));
  m.add(new MenuItem("Options..."));
  m.addActionListener(this);
  mb.add(m);

代码示例来源:origin: net.imagej/ij

addExample(submenu, "Plot Styles", "Plot_Styles_.ijm");
addExample(submenu, "Random Data", "Random_Data_.ijm");
submenu.addActionListener(listener);
menu.add(submenu);
addExample(submenu, "Circle Tool", "Circle_Tool.ijm");
addExample(submenu, "Star Tool", "Star_Tool.ijm");
submenu.addActionListener(listener);
menu.add(submenu);
addExample(submenu, "Event Listener", "Event_Listener.js");
addExample(submenu, "FFT Filter", "FFT_Filter.js");
submenu.addActionListener(listener);
menu.add(submenu);
submenu = new Menu("BeanShell");
addExample(submenu, "Arrow Plot", "Arrow_Plot.bsh");
addExample(submenu, "Sine/Cosine Table", "Sine_Cosine_Table.bsh");
submenu.addActionListener(listener);
menu.add(submenu);
submenu = new Menu("Python");
addExample(submenu, "Spiral Rotation", "Spiral_Rotation.py");
addExample(submenu, "Overlay", "Overlay.py");
submenu.addActionListener(listener);
menu.add(submenu);
submenu = new Menu("Java");
addExample(submenu, "Plugin Frame", "Plugin_Frame.java");

代码示例来源:origin: imagej/ImageJA

addExample(submenu, "Plot Styles", "Plot_Styles_.ijm");
addExample(submenu, "Random Data", "Random_Data_.ijm");
submenu.addActionListener(listener);
menu.add(submenu);
addExample(submenu, "Circle Tool", "Circle_Tool.ijm");
addExample(submenu, "Star Tool", "Star_Tool.ijm");
submenu.addActionListener(listener);
menu.add(submenu);
addExample(submenu, "Event Listener", "Event_Listener.js");
addExample(submenu, "FFT Filter", "FFT_Filter.js");
submenu.addActionListener(listener);
menu.add(submenu);
submenu = new Menu("BeanShell");
addExample(submenu, "Arrow Plot", "Arrow_Plot.bsh");
addExample(submenu, "Sine/Cosine Table", "Sine_Cosine_Table.bsh");
submenu.addActionListener(listener);
menu.add(submenu);
submenu = new Menu("Python");
addExample(submenu, "Spiral Rotation", "Spiral_Rotation.py");
addExample(submenu, "Overlay", "Overlay.py");
submenu.addActionListener(listener);
menu.add(submenu);
submenu = new Menu("Java");
addExample(submenu, "Plugin Frame", "Plugin_Frame.java");

代码示例来源:origin: net.imagej/ij

m.add(new MenuItem("Revert"));
m.add(new MenuItem("Print..."));
m.addActionListener(this);
fileMenu = m;
mb.add(m);
m.add(new MenuItem("Zap Gremlins"));
m.add(new MenuItem("Copy to Image Info"));
m.addActionListener(this);
mb.add(m);
editMenu = m;
m.add(monospaced);
m.add(new MenuItem("Save Settings"));
m.addActionListener(this);
mb.add(m);

代码示例来源:origin: imagej/ImageJA

m.add(new MenuItem("Revert"));
m.add(new MenuItem("Print..."));
m.addActionListener(this);
fileMenu = m;
mb.add(m);
m.add(new MenuItem("Zap Gremlins"));
m.add(new MenuItem("Copy to Image Info"));
m.addActionListener(this);
mb.add(m);
editMenu = m;
m.add(monospaced);
m.add(new MenuItem("Save Settings"));
m.addActionListener(this);
mb.add(m);

相关文章