java.awt.MenuItem.getActionListeners()方法的使用及代码示例

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

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

暂无

代码示例

代码示例来源:origin: net.java.openjdk.cacio/cacio-shared

public void actionPerformed(ActionEvent e) {
  ActionListener[] l = getAWTMenu().getActionListeners();
  if (l != null && l.length > 0) {
    MenuItem i = getAWTMenu();
    for (int idx = 0; idx < l.length; idx++) {
      ActionEvent ev = new ActionEvent(i, idx,
                       e.getActionCommand());
      l[idx].actionPerformed(ev);
    }
  }
}

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

/** Returns, as an array of strings, a list of the LUTs in the Image/Lookup Tables menu. */
public static String[] getLuts() {
  ArrayList list = new ArrayList();
  Hashtable commands = Menus.getCommands();
  Menu lutsMenu = Menus.getImageJMenu("Image>Lookup Tables");
  if (commands==null || lutsMenu==null)
    return new String[0];
  for (int i=0; i<lutsMenu.getItemCount(); i++) {
    MenuItem menuItem = lutsMenu.getItem(i);
    if (menuItem.getActionListeners().length == 0) // separator?
      continue;
    String label = menuItem.getLabel();
    if (label.equals("Invert LUT") || label.equals("Apply LUT"))
      continue;
    String command = (String)commands.get(label);
    if (command==null || command.startsWith("ij.plugin.LutLoader"))
      list.add(label);
  }
  return (String[])list.toArray(new String[list.size()]);
}

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

public static String[] getSampleImageNames() {
  ArrayList list = new ArrayList();
  Hashtable commands = Menus.getCommands();
  Menu samplesMenu = Menus.getImageJMenu("File>Open Samples");
  if (samplesMenu==null)
    return new String[0];
  for (int i=0; i<samplesMenu.getItemCount(); i++) {
    MenuItem menuItem = samplesMenu.getItem(i);
    if (menuItem.getActionListeners().length == 0) continue; // separator?
    String label = menuItem.getLabel();
    if (label.contains("Cache Sample Images")) continue;
    String command = (String)commands.get(label);
    if (command==null) continue;
    String[] items = command.split("\"");
    if (items.length!=3) continue;
    String name = items[1];
    list.add(name);
  }
  return (String[])list.toArray(new String[list.size()]);
}

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

/** Returns, as an array of strings, a list of the LUTs in the Image/Lookup Tables menu. */
public static String[] getLuts() {
  ArrayList list = new ArrayList();
  Hashtable commands = Menus.getCommands();
  Menu lutsMenu = Menus.getImageJMenu("Image>Lookup Tables");
  if (commands==null || lutsMenu==null)
    return new String[0];
  for (int i=0; i<lutsMenu.getItemCount(); i++) {
    MenuItem menuItem = lutsMenu.getItem(i);
    if (menuItem.getActionListeners().length == 0) // separator?
      continue;
    String label = menuItem.getLabel();
    if (label.equals("Invert LUT") || label.equals("Apply LUT"))
      continue;
    String command = (String)commands.get(label);
    if (command==null || command.startsWith("ij.plugin.LutLoader"))
      list.add(label);
  }
  return (String[])list.toArray(new String[list.size()]);
}

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

public static String[] getSampleImageNames() {
  ArrayList list = new ArrayList();
  Hashtable commands = Menus.getCommands();
  Menu samplesMenu = Menus.getImageJMenu("File>Open Samples");
  if (samplesMenu==null)
    return new String[0];
  for (int i=0; i<samplesMenu.getItemCount(); i++) {
    MenuItem menuItem = samplesMenu.getItem(i);
    if (menuItem.getActionListeners().length == 0) continue; // separator?
    String label = menuItem.getLabel();
    if (label.contains("Cache Sample Images")) continue;
    String command = (String)commands.get(label);
    if (command==null) continue;
    String[] items = command.split("\"");
    if (items.length!=3) continue;
    String name = items[1];
    list.add(name);
  }
  return (String[])list.toArray(new String[list.size()]);
}

代码示例来源:origin: sc.fiji/3D_Viewer

for (final ActionListener l : item.getActionListeners())
  jitem.addActionListener(l);

相关文章