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

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

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

暂无

代码示例

代码示例来源:origin: igniterealtime/Openfire

showMenuItem.setActionCommand("Hide/Show");
menu.add(showMenuItem);
startMenuItem.setActionCommand("Start");
menu.add(startMenuItem);
stopMenuItem.setActionCommand("Stop");
menu.add(stopMenuItem);
browserMenuItem.setActionCommand("Launch Admin");
menu.add(browserMenuItem);
quitMenuItem.setActionCommand("Quit");
menu.add(quitMenuItem);

代码示例来源:origin: com.h2database/h2

itemConsole.setActionCommand("console");
itemConsole.addActionListener(this);
itemConsole.setFont(font);
menuConsole.add(itemConsole);
MenuItem itemStatus = new MenuItem("Status");
itemStatus.setActionCommand("status");
itemStatus.addActionListener(this);
itemStatus.setFont(font);
MenuItem itemExit = new MenuItem("Exit");
itemExit.setFont(font);
itemExit.setActionCommand("exit");
itemExit.addActionListener(this);
menuConsole.add(itemExit);

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

private void addMenuListener(MenuItem item, String action) {
  item.addActionListener(this);
  item.setActionCommand(action);
}

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

private static void addExample(Menu menu, String label, String command) {
  MenuItem item = new MenuItem(label);
  menu.add(item);
  item.setActionCommand(command);
}

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

private static void addExample(Menu menu, String label, String command) {
  MenuItem item = new MenuItem(label);
  menu.add(item);
  item.setActionCommand(command);
}

代码示例来源:origin: mikaelhg/openblocks

/**
 * Initializes the context menu for deleting Comments.
 */
private static void initRemoveCommentMenu() {
  removeCommentItem = new MenuItem("Delete Comment");
  removeCommentItem.setActionCommand(REMOVE_COMMENT_BLOCK);
  removeCommentItem.addActionListener(rndBlockMenu);
  removeCommentMenu.add(removeCommentItem);
  //rndBlockMenu.add(runBlockItem);
  removeCommentMenuInit = true;
}

代码示例来源:origin: mikaelhg/openblocks

/**
 * Initializes the context menu for adding Comments.
 */
private static void initAddCommentMenu() {
  addCommentItem = new MenuItem("Add Comment");
  addCommentItem.setActionCommand(ADD_COMMENT_BLOCK);
  addCommentItem.addActionListener(rndBlockMenu);
  addCommentMenu.add(addCommentItem);
  addCommentMenuInit = true;
}

代码示例来源:origin: mikaelhg/openblocks

/**
 * Initializes the context menu for the BlockCanvas
 *
 */
private static void initCanvasMenu() {
  arrangeAllBlocks = new MenuItem("Organize all blocks");  //TODO some workspaces don't have pages
  arrangeAllBlocks.setActionCommand(ARRANGE_ALL_BLOCKS);
  arrangeAllBlocks.addActionListener(canvasMenu);
  canvasMenu.add(arrangeAllBlocks);
  canvasMenuInit = true;
}

代码示例来源:origin: com.h2database/com.springsource.org.h2

itemConsole.setActionCommand("console");
itemConsole.addActionListener(this);
itemConsole.setFont(font);
menuConsole.add(itemConsole);
MenuItem itemStatus = new MenuItem("Status");
itemStatus.setActionCommand("status");
itemStatus.addActionListener(this);
itemStatus.setFont(font);
MenuItem itemExit = new MenuItem("Exit");
itemExit.setFont(font);
itemExit.setActionCommand("exit");
itemExit.addActionListener(this);
menuConsole.add(itemExit);

代码示例来源:origin: org.nuiton.web/nuiton-web

MenuItem browserItem = new MenuItem("Start browser");
browserItem.addActionListener(this);
browserItem.setActionCommand("browser");
menu.add(browserItem);
stopItem.setActionCommand("stop");
menu.add(stopItem);

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

ServerMenu(ServerBrowser browser) {
  super();
  this.browser = browser;
  Menu server = new Menu("Admin-Server");
  add(server);
  MenuItem open = new MenuItem("Open");
  open.setActionCommand("open");
  open.addActionListener(this);
  server.add( open );
  MenuItem newOpen = new MenuItem("Open in new window");
  newOpen.setActionCommand("new");
  newOpen.addActionListener(this);
  server.add( newOpen );
  server.addSeparator();
  MenuItem close = new MenuItem("Close window");
  close.setActionCommand("close");
  close.addActionListener(this);
  server.add( close );
  MenuItem quit = new MenuItem("Exit");
  quit.setActionCommand("quit");
  quit.addActionListener(this);
  server.add( quit );
  }
}

代码示例来源:origin: chatty/chatty

public TrayIconManager(Image image) {
  if (SystemTray.isSupported()) {
    tray = SystemTray.getSystemTray();
    
    popup = new PopupMenu();
    MenuItem showItem = new MenuItem("Show");
    showItem.setActionCommand("show");
    popup.add(showItem);
    MenuItem exitItem = new MenuItem("Exit");
    exitItem.setActionCommand("exit");
    popup.add(exitItem);
    trayIcon = new TrayIcon(image, "Chatty");
    trayIcon.setImageAutoSize(true);
    trayIcon.setPopupMenu(popup);
  } else {
    tray = null;
    trayIcon = null;
    popup = null;
  }
}

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

EditorMenu(RulesEditorFrame frame) {
  this.frame = frame;
  //menu file
  Menu file = new Menu("File");
  this.add(file);
  MenuItem save = new MenuItem("Save Rules");
  save.setActionCommand("save");
  save.addActionListener(this);
  file.add( save );
  MenuItem quit = new MenuItem("Quit");
  quit.setActionCommand("quit");
  quit.addActionListener(this);
  file.add( quit );
  //menu rules
  Menu rules = new Menu("Rule");
  this.add(rules);
  MenuItem add = new MenuItem("Add Rule");
  add.setActionCommand("add");
  add.addActionListener(this);
  rules.add( add );
  MenuItem replace = new MenuItem("Replace Rule");
  replace.setActionCommand("replace");
  replace.addActionListener(this);
  rules.add( replace );
  MenuItem remove = new MenuItem("Remove Rule");
  remove.setActionCommand("remove");
  remove.addActionListener(this);
  rules.add( remove );
  }
}

代码示例来源:origin: ome/bio-formats_plugins

public SearchableWindow(String title, String headings, String data,
 int w, int h)
{
 super(title, headings, data, w, h);
 index = -1;
 panel = getTextPanel();
 MenuBar menubar = getMenuBar();
 Menu menu = menubar.getMenu(0);
 MenuItem search = new MenuItem("Search...");
 search.setActionCommand("search");
 search.addActionListener(this);
 menu.add(search);
}

代码示例来源:origin: openmicroscopy/bioformats

public SearchableWindow(String title, String headings, String data,
 int w, int h)
{
 super(title, headings, data, w, h);
 index = -1;
 panel = getTextPanel();
 MenuBar menubar = getMenuBar();
 Menu menu = menubar.getMenu(0);
 MenuItem search = new MenuItem("Search...");
 search.setActionCommand("search");
 search.addActionListener(this);
 menu.add(search);
}

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

String childStr = name.substring(pos + 1).trim();
MenuItem mnuItem = new MenuItem();
mnuItem.setActionCommand(name);
mnuItem.setLabel(childStr);
for (int jj = 0; jj < subMenus.size(); jj++) {

代码示例来源:origin: de.alpharogroup/swing-components

/**
 * Factory method for create a {@link PopupMenu} object.
 *
 * @param menuItemBeans
 *            the menu item beans
 * @return the new {@link PopupMenu}.
 */
public static PopupMenu newPopupMenu(final List<MenuItemBean> menuItemBeans)
{
  final PopupMenu popupMenu = new PopupMenu();
  for (final MenuItemBean menuItemBean : menuItemBeans)
  {
    final MenuItem miBringToFront = new MenuItem(menuItemBean.getLabel());
    miBringToFront.setActionCommand(menuItemBean.getCommand());
    miBringToFront.addActionListener(menuItemBean.getActionListener());
    popupMenu.add(miBringToFront);
  }
  return popupMenu;
}

代码示例来源:origin: trekawek/radioblock

public PlayerTrayIcon(boolean windowVisible) {
  icon = new TrayIcon(NORMAL_ICON, "Radioblock");
  startItem = new MenuItem("Start");
  startItem.setActionCommand("start");
  startItem.setEnabled(true);
  startItem.addActionListener(e -> listener.startPlayer());
  stopItem = new MenuItem("Stop");
  stopItem.setActionCommand("stop");
  stopItem.setEnabled(false);
  stopItem.addActionListener(e -> listener.stopPlayer());
  showWindowItem = new CheckboxMenuItem("Show window");
  showWindowItem.setState(windowVisible);
  showWindowItem.addItemListener(e -> listener.setWindowVisibility(showWindowItem.getState()));
  MenuItem quitItem = new MenuItem("Quit");
  quitItem.setActionCommand("quit");
  quitItem.addActionListener(e -> System.exit(0));
  final PopupMenu popup = new PopupMenu();
  popup.add(startItem);
  popup.add(stopItem);
  popup.add(showWindowItem);
  popup.add(quitItem);
  icon.setPopupMenu(popup);
  try {
    SystemTray.getSystemTray().add(icon);
  } catch (AWTException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: org.wowtools/h2

itemConsole.setActionCommand("console");
itemConsole.addActionListener(this);
itemConsole.setFont(font);
menuConsole.add(itemConsole);
MenuItem itemStatus = new MenuItem("Status");
itemStatus.setActionCommand("status");
itemStatus.addActionListener(this);
itemStatus.setFont(font);
MenuItem itemExit = new MenuItem("Exit");
itemExit.setFont(font);
itemExit.setActionCommand("exit");
itemExit.addActionListener(this);
menuConsole.add(itemExit);

代码示例来源:origin: com.eventsourcing/h2

itemConsole.setActionCommand("console");
itemConsole.addActionListener(this);
itemConsole.setFont(font);
menuConsole.add(itemConsole);
MenuItem itemStatus = new MenuItem("Status");
itemStatus.setActionCommand("status");
itemStatus.addActionListener(this);
itemStatus.setFont(font);
MenuItem itemExit = new MenuItem("Exit");
itemExit.setFont(font);
itemExit.setActionCommand("exit");
itemExit.addActionListener(this);
menuConsole.add(itemExit);

相关文章