javax.swing.JMenuItem.setDisplayedMnemonicIndex()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(95)

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

JMenuItem.setDisplayedMnemonicIndex介绍

暂无

代码示例

代码示例来源:origin: robo-code/robocode

private JMenuItem getHelpRobocodeMenuItem() {
  if (helpRobocodeMenuItem == null) {
    helpRobocodeMenuItem = new JMenuItem();
    helpRobocodeMenuItem.setText("Robocode home page");
    helpRobocodeMenuItem.setMnemonic('H');
    helpRobocodeMenuItem.setDisplayedMnemonicIndex(9);
    helpRobocodeMenuItem.addActionListener(eventHandler);
  }
  return helpRobocodeMenuItem;
}

代码示例来源:origin: robo-code/robocode

private JMenuItem getHelpRoboWikiMenuItem() {
  if (helpRoboWikiMenuItem == null) {
    helpRoboWikiMenuItem = new JMenuItem();
    helpRoboWikiMenuItem.setText("RoboWiki site");
    helpRoboWikiMenuItem.setMnemonic('W');
    helpRoboWikiMenuItem.setDisplayedMnemonicIndex(4);
    helpRoboWikiMenuItem.addActionListener(eventHandler);
  }
  return helpRoboWikiMenuItem;
}

代码示例来源:origin: robo-code/robocode

private JMenuItem getHelpFaqMenuItem() {
  if (helpFaqMenuItem == null) {
    helpFaqMenuItem = new JMenuItem();
    helpFaqMenuItem.setText("Robocode FAQ");
    helpFaqMenuItem.setMnemonic('F');
    helpFaqMenuItem.setDisplayedMnemonicIndex(9);
    helpFaqMenuItem.addActionListener(eventHandler);
  }
  return helpFaqMenuItem;
}

代码示例来源:origin: robo-code/robocode

private JMenuItem getHelpRobocodeApiMenuItem() {
  if (helpRobocodeApiMenuItem == null) {
    helpRobocodeApiMenuItem = new JMenuItem();
    helpRobocodeApiMenuItem.setText("Robocode API");
    helpRobocodeApiMenuItem.setMnemonic('I');
    helpRobocodeApiMenuItem.setDisplayedMnemonicIndex(11);
    helpRobocodeApiMenuItem.addActionListener(eventHandler);
  }
  return helpRobocodeApiMenuItem;
}

代码示例来源:origin: robo-code/robocode

private JMenuItem getOptionsRecalculateCpuConstantMenuItem() {
  if (optionsRecalculateCpuConstantMenuItem == null) {
    optionsRecalculateCpuConstantMenuItem = new JMenuItem();
    optionsRecalculateCpuConstantMenuItem.setText("Recalculate CPU constant");
    optionsRecalculateCpuConstantMenuItem.setMnemonic('e');
    optionsRecalculateCpuConstantMenuItem.setDisplayedMnemonicIndex(1);
    optionsRecalculateCpuConstantMenuItem.addActionListener(eventHandler);
  }
  return optionsRecalculateCpuConstantMenuItem;
}

代码示例来源:origin: robo-code/robocode

private JMenuItem getReadMeMenuItem() {
  if (helpReadMeMenuItem == null) {
    helpReadMeMenuItem = new JMenuItem();
    helpReadMeMenuItem.setText("ReadMe");
    helpReadMeMenuItem.setMnemonic('M');
    helpReadMeMenuItem.setDisplayedMnemonicIndex(4);
    helpReadMeMenuItem.addActionListener(eventHandler);
  }
  return helpReadMeMenuItem;
}

代码示例来源:origin: robo-code/robocode

private JMenuItem getCompilerCompileMenuItem() {
  if (compilerCompileMenuItem == null) {
    compilerCompileMenuItem = new JMenuItem();
    compilerCompileMenuItem.setText("Compile");
    compilerCompileMenuItem.setMnemonic('m');
    compilerCompileMenuItem.setDisplayedMnemonicIndex(2);
    compilerCompileMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, MENU_SHORTCUT_KEY_MASK));
    compilerCompileMenuItem.addActionListener(eventHandler);
  }
  return compilerCompileMenuItem;
}

代码示例来源:origin: robo-code/robocode

private JMenuItem getFileExitMenuItem() {
  if (fileExitMenuItem == null) {
    fileExitMenuItem = new JMenuItem();
    fileExitMenuItem.setText("Exit");
    fileExitMenuItem.setMnemonic('x');
    fileExitMenuItem.setDisplayedMnemonicIndex(1);
    fileExitMenuItem.addActionListener(eventHandler);
  }
  return fileExitMenuItem;
}

代码示例来源:origin: robo-code/robocode

private JMenuItem getHelpRobocodeApiMenuItem() {
  if (helpRobocodeApiMenuItem == null) {
    helpRobocodeApiMenuItem = new JMenuItem();
    helpRobocodeApiMenuItem.setText("Robocode API");
    helpRobocodeApiMenuItem.setMnemonic('A');
    helpRobocodeApiMenuItem.setDisplayedMnemonicIndex(9);
    helpRobocodeApiMenuItem.addActionListener(eventHandler);
  }
  return helpRobocodeApiMenuItem;
}

代码示例来源:origin: robo-code/robocode

private JMenuItem getEditCutMenuItem() {
  if (editCutMenuItem == null) {
    editCutMenuItem = new JMenuItem();
    editCutMenuItem.setText("Cut");
    editCutMenuItem.setMnemonic('t');
    editCutMenuItem.setDisplayedMnemonicIndex(2);
    editCutMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, MENU_SHORTCUT_KEY_MASK));
    editCutMenuItem.addActionListener(eventHandler);
  }
  return editCutMenuItem;
}

代码示例来源:origin: robo-code/robocode

public JMenuItem getBattleSaveAsMenuItem() {
  if (battleSaveAsMenuItem == null) {
    battleSaveAsMenuItem = new JMenuItem();
    battleSaveAsMenuItem.setText("Save As");
    battleSaveAsMenuItem.setMnemonic('A');
    battleSaveAsMenuItem.setDisplayedMnemonicIndex(5);
    battleSaveAsMenuItem.setAccelerator(
        KeyStroke.getKeyStroke(KeyEvent.VK_S, MENU_SHORTCUT_KEY_MASK | InputEvent.SHIFT_MASK, false));
    battleSaveAsMenuItem.setEnabled(false);
    battleSaveAsMenuItem.addActionListener(eventHandler);
  }
  return battleSaveAsMenuItem;
}

代码示例来源:origin: robo-code/robocode

private JMenuItem getBattleExitMenuItem() {
  if (battleExitMenuItem == null) {
    battleExitMenuItem = new JMenuItem();
    battleExitMenuItem.setText("Exit");
    battleExitMenuItem.setMnemonic('x');
    battleExitMenuItem.setDisplayedMnemonicIndex(1);
    battleExitMenuItem.addActionListener(eventHandler);
  }
  return battleExitMenuItem;
}

代码示例来源:origin: robo-code/robocode

private JMenuItem getHelpRoboRumbleMenuItem() {
  if (helpRoboRumbleMenuItem == null) {
    helpRoboRumbleMenuItem = new JMenuItem();
    helpRoboRumbleMenuItem.setText("RoboRumble");
    helpRoboRumbleMenuItem.setMnemonic('R');
    helpRoboRumbleMenuItem.setDisplayedMnemonicIndex(9);
    helpRoboRumbleMenuItem.addActionListener(eventHandler);
  }
  return helpRoboRumbleMenuItem;
}

代码示例来源:origin: robo-code/robocode

private JMenuItem getFileExtractMenuItem() {
  if (fileExtractMenuItem == null) {
    fileExtractMenuItem = new JMenuItem();
    fileExtractMenuItem.setText("Extract downloaded robot for editing");
    fileExtractMenuItem.setMnemonic('t');
    fileExtractMenuItem.setDisplayedMnemonicIndex(2);
    fileExtractMenuItem.addActionListener(eventHandler);
  }
  return fileExtractMenuItem;
}

代码示例来源:origin: robo-code/robocode

private JMenuItem getEditDeleteMenuItem() {
  if (editDeleteMenuItem == null) {
    editDeleteMenuItem = new JMenuItem();
    editDeleteMenuItem.setText("Delete");
    editDeleteMenuItem.setMnemonic('l');
    editDeleteMenuItem.setDisplayedMnemonicIndex(2);
    editDeleteMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0));
    editDeleteMenuItem.addActionListener(eventHandler);
  }
  return editDeleteMenuItem;
}

代码示例来源:origin: robo-code/robocode

private JMenuItem getEditFindNextMenuItem() {
  if (editFindNextMenuItem == null) {
    editFindNextMenuItem = new JMenuItem();
    editFindNextMenuItem.setText("Find Next");
    editFindNextMenuItem.setMnemonic('N');
    editFindNextMenuItem.setDisplayedMnemonicIndex(5);
    editFindNextMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G, MENU_SHORTCUT_KEY_MASK));
    editFindNextMenuItem.addActionListener(eventHandler);
  }
  return editFindNextMenuItem;
}

代码示例来源:origin: robo-code/robocode

private JMenuItem getEditSelectAllMenuItem() {
  if (editSelectAllMenuItem == null) {
    editSelectAllMenuItem = new JMenuItem();
    editSelectAllMenuItem.setText("Select All");
    editSelectAllMenuItem.setMnemonic('A');
    editSelectAllMenuItem.setDisplayedMnemonicIndex(7);
    editSelectAllMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, MENU_SHORTCUT_KEY_MASK));
    editSelectAllMenuItem.addActionListener(eventHandler);
  }
  return editSelectAllMenuItem;
}

代码示例来源:origin: robo-code/robocode

private JMenuItem getWindowCloseAllMenuItem() {
  if (windowCloseAllMenuItem == null) {
    windowCloseAllMenuItem = new JMenuItem();
    windowCloseAllMenuItem.setText("Close All");
    windowCloseAllMenuItem.setMnemonic('A');
    windowCloseAllMenuItem.setDisplayedMnemonicIndex(6);
    windowCloseAllMenuItem.addActionListener(eventHandler);
  }
  return windowCloseAllMenuItem;
}

代码示例来源:origin: robo-code/robocode

public JMenuItem getFileSaveAsMenuItem() {
  if (fileSaveAsMenuItem == null) {
    fileSaveAsMenuItem = new JMenuItem();
    fileSaveAsMenuItem.setText("Save As");
    fileSaveAsMenuItem.setMnemonic('A');
    fileSaveAsMenuItem.setDisplayedMnemonicIndex(5);
    fileSaveAsMenuItem.setAccelerator(
        KeyStroke.getKeyStroke(KeyEvent.VK_S, MENU_SHORTCUT_KEY_MASK | Event.SHIFT_MASK));
    fileSaveAsMenuItem.addActionListener(eventHandler);
    fileSaveAsMenuItem.setEnabled(false);
  }
  return fileSaveAsMenuItem;
}

代码示例来源:origin: stackoverflow.com

JMenuItem mnuSortAlbum =new JMenuItem("by album");
 mnuSortAlbum.setMnemonic(KeyEvent.VK_M);
 mnuSortAlbum.setDisplayedMnemonicIndex(1);
 mnuSortAlbum.setActionCommand("album");
 mnuSortAlbum.addActionListener(this);
 mnuSort.add(mnuSortAlbum);

相关文章

JMenuItem类方法