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

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

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

JButton.setDisplayedMnemonicIndex介绍

暂无

代码示例

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

private JButton getAddButton() {
  if (addButton == null) {
    addButton = new JButton("Add");
    addButton.setDisplayedMnemonicIndex(2);
    addButton.addActionListener(eventHandler);
  }
  return addButton;
}

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

private JButton getRemoveButton() {
  if (removeButton == null) {
    removeButton = new JButton("Remove");
    removeButton.setDisplayedMnemonicIndex(3);
    removeButton.addActionListener(eventHandler);
  }
  return removeButton;
}

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

private JButton getAddAllButton() {
  if (addAllButton == null) {
    addAllButton = new JButton();
    addAllButton.setText("Add All ->");
    addAllButton.setMnemonic('l');
    addAllButton.setDisplayedMnemonicIndex(5);
    addAllButton.addActionListener(eventHandler);
  }
  return addAllButton;
}

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

private JButton getRemoveButton() {
  if (removeButton == null) {
    removeButton = new JButton();
    removeButton.setText("<- Remove");
    removeButton.setMnemonic('m');
    removeButton.setDisplayedMnemonicIndex(5);
    removeButton.addActionListener(eventHandler);
  }
  return removeButton;
}

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

public JButton getReplaceAllButton() {
  if (replaceAllButton == null) {
    replaceAllButton = new JButton();
    replaceAllButton.setText("Replace All");
    replaceAllButton.setMnemonic('A');
    replaceAllButton.setDisplayedMnemonicIndex(8);
    replaceAllButton.addActionListener(this);
  }
  return replaceAllButton;
}

代码示例来源:origin: io.ultreia.java4all.i18n/i18n-editor

private JButton addAction(JPanel actions, Action action) {
  JButton result = new JButton(action);
  actions.add(result);
  result.setEnabled(false);
  result.setDisplayedMnemonicIndex(result.getText().length() - 2);
  return result;
}

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

private JButton getEnableAllSoundsButton() {
  if (enableAllSoundsButton == null) {
    enableAllSoundsButton = new JButton("Enable all");
    enableAllSoundsButton.setMnemonic('a');
    enableAllSoundsButton.setDisplayedMnemonicIndex(7);
    enableAllSoundsButton.addActionListener(eventHandler);
  }
  return enableAllSoundsButton;
}

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

private JButton getDisableAllSoundsButton() {
  if (disableAllSoundsButton == null) {
    disableAllSoundsButton = new JButton("Disable all");
    disableAllSoundsButton.setMnemonic('i');
    disableAllSoundsButton.setDisplayedMnemonicIndex(1);
    disableAllSoundsButton.addActionListener(eventHandler);
  }
  return disableAllSoundsButton;
}

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

private JButton getMixerDefaultButton() {
  if (mixerDefaultButton == null) {
    mixerDefaultButton = new JButton("Default");
    mixerDefaultButton.setMnemonic('u');
    mixerDefaultButton.setDisplayedMnemonicIndex(4);
    mixerDefaultButton.addActionListener(eventHandler);
  }
  return mixerDefaultButton;
}

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

private JButton getPredefinedPlatformDefaultButton() {
  if (predefinedPlaformDefaultButton == null) {
    predefinedPlaformDefaultButton = new JButton("Default");
    predefinedPlaformDefaultButton.setMnemonic('u');
    predefinedPlaformDefaultButton.setDisplayedMnemonicIndex(4);
    predefinedPlaformDefaultButton.addActionListener(eventHandler);
  }
  return predefinedPlaformDefaultButton;
}

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

private JButton getPredefinedSpeedButton() {
  if (predefinedSpeedButton == null) {
    predefinedSpeedButton = new JButton("Speed");
    predefinedSpeedButton.setMnemonic('p');
    predefinedSpeedButton.setDisplayedMnemonicIndex(1);
    predefinedSpeedButton.addActionListener(eventHandler);
  }
  return predefinedSpeedButton;
}

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

private JButton getEnableAllViewOptionsButton() {
  if (enableAllViewOptionsButton == null) {
    enableAllViewOptionsButton = new JButton("Enable all");
    enableAllViewOptionsButton.setMnemonic('a');
    enableAllViewOptionsButton.setDisplayedMnemonicIndex(7);
    enableAllViewOptionsButton.addActionListener(eventHandler);
  }
  return enableAllViewOptionsButton;
}

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

public JButton getCloseButton() {
  if (closeButton == null) {
    closeButton = new JButton();
    closeButton.setText("Close");
    closeButton.setMnemonic('l');
    closeButton.setDisplayedMnemonicIndex(1);
    closeButton.addActionListener(this);
  }
  return closeButton;
}

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

private JButton getDefaultViewOptionsButton() {
  if (defaultViewOptionsButton == null) {
    defaultViewOptionsButton = new JButton("Defaults");
    defaultViewOptionsButton.setMnemonic('u');
    defaultViewOptionsButton.setDisplayedMnemonicIndex(4);
    defaultViewOptionsButton.addActionListener(eventHandler);
  }
  return defaultViewOptionsButton;
}

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

private JButton getDisableAllViewOptionsButton() {
  if (disableAllViewOptionsButton == null) {
    disableAllViewOptionsButton = new JButton("Disable all");
    disableAllViewOptionsButton.setMnemonic('i');
    disableAllViewOptionsButton.setDisplayedMnemonicIndex(1);
    disableAllViewOptionsButton.addActionListener(eventHandler);
  }
  return disableAllViewOptionsButton;
}

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

private JButton getRemoveAllButton() {
  if (removeAllButton == null) {
    removeAllButton = new JButton();
    removeAllButton.setText("<- Remove All");
    removeAllButton.setMnemonic('v');
    removeAllButton.setDisplayedMnemonicIndex(7);
    removeAllButton.addActionListener(eventHandler);
  }
  return removeAllButton;
}

代码示例来源:origin: com.anrisoftware.prefdialog/prefdialog-corefields

/**
 * Sets the mnemonic index for the open the file chooser dialog button.
 * <p>
 * <h2>AWT Thread</h2>
 * <p>
 * Should be called in the AWT thread.
 * 
 * @param index
 *            the mnemonic index.
 */
public void setButtonMnemonicIndex(int index) {
  this.buttonMnemonicIndex = index;
  getOpenFileChooser().setDisplayedMnemonicIndex(index);
}

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

/**
 * Return the restartButton
 *
 * @return JButton
 */
private JButton getRestartButton() {
  if (restartButton == null) {
    restartButton = new JButton("Restart");
    restartButton.setMnemonic('t');
    restartButton.setDisplayedMnemonicIndex(3);
    restartButton.setHorizontalTextPosition(SwingConstants.CENTER);
    restartButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    restartButton.addActionListener(eventHandler);
    restartButton.setEnabled(false);
  }
  return restartButton;
}

代码示例来源:origin: com.google.code.findbugs/findbugs

private static void addButton(JFrame frame, String s) {
  AnnotatedString as = new AnnotatedString(s);
  JButton button = new JButton(as.toString());
  button.setMnemonic(as.getMnemonic());
  button.setDisplayedMnemonicIndex(as.getMnemonicIndex());
  frame.getContentPane().add(button);
  System.out.println("\"" + s + "\" \"" + as + "\" '" + as.getMnemonic() + "' " + as.getMnemonicIndex());
}

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

public void setFinishButtonTextAndMnemonic(String text, char mnemonic, int mnemonicIndex) {
  getFinishButton().setText(text);
  getFinishButton().setMnemonic(mnemonic);
  getFinishButton().setDisplayedMnemonicIndex(mnemonicIndex);
}

相关文章

JButton类方法