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

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

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

JButton.setDisplayedMnemonicIndex介绍

暂无

代码示例

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

  1. private JButton getAddButton() {
  2. if (addButton == null) {
  3. addButton = new JButton("Add");
  4. addButton.setDisplayedMnemonicIndex(2);
  5. addButton.addActionListener(eventHandler);
  6. }
  7. return addButton;
  8. }

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

  1. private JButton getRemoveButton() {
  2. if (removeButton == null) {
  3. removeButton = new JButton("Remove");
  4. removeButton.setDisplayedMnemonicIndex(3);
  5. removeButton.addActionListener(eventHandler);
  6. }
  7. return removeButton;
  8. }

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

  1. private JButton getAddAllButton() {
  2. if (addAllButton == null) {
  3. addAllButton = new JButton();
  4. addAllButton.setText("Add All ->");
  5. addAllButton.setMnemonic('l');
  6. addAllButton.setDisplayedMnemonicIndex(5);
  7. addAllButton.addActionListener(eventHandler);
  8. }
  9. return addAllButton;
  10. }

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

  1. private JButton getRemoveButton() {
  2. if (removeButton == null) {
  3. removeButton = new JButton();
  4. removeButton.setText("<- Remove");
  5. removeButton.setMnemonic('m');
  6. removeButton.setDisplayedMnemonicIndex(5);
  7. removeButton.addActionListener(eventHandler);
  8. }
  9. return removeButton;
  10. }

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

  1. public JButton getReplaceAllButton() {
  2. if (replaceAllButton == null) {
  3. replaceAllButton = new JButton();
  4. replaceAllButton.setText("Replace All");
  5. replaceAllButton.setMnemonic('A');
  6. replaceAllButton.setDisplayedMnemonicIndex(8);
  7. replaceAllButton.addActionListener(this);
  8. }
  9. return replaceAllButton;
  10. }

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

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

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

  1. private JButton getEnableAllSoundsButton() {
  2. if (enableAllSoundsButton == null) {
  3. enableAllSoundsButton = new JButton("Enable all");
  4. enableAllSoundsButton.setMnemonic('a');
  5. enableAllSoundsButton.setDisplayedMnemonicIndex(7);
  6. enableAllSoundsButton.addActionListener(eventHandler);
  7. }
  8. return enableAllSoundsButton;
  9. }

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

  1. private JButton getDisableAllSoundsButton() {
  2. if (disableAllSoundsButton == null) {
  3. disableAllSoundsButton = new JButton("Disable all");
  4. disableAllSoundsButton.setMnemonic('i');
  5. disableAllSoundsButton.setDisplayedMnemonicIndex(1);
  6. disableAllSoundsButton.addActionListener(eventHandler);
  7. }
  8. return disableAllSoundsButton;
  9. }

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

  1. private JButton getMixerDefaultButton() {
  2. if (mixerDefaultButton == null) {
  3. mixerDefaultButton = new JButton("Default");
  4. mixerDefaultButton.setMnemonic('u');
  5. mixerDefaultButton.setDisplayedMnemonicIndex(4);
  6. mixerDefaultButton.addActionListener(eventHandler);
  7. }
  8. return mixerDefaultButton;
  9. }

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

  1. private JButton getPredefinedPlatformDefaultButton() {
  2. if (predefinedPlaformDefaultButton == null) {
  3. predefinedPlaformDefaultButton = new JButton("Default");
  4. predefinedPlaformDefaultButton.setMnemonic('u');
  5. predefinedPlaformDefaultButton.setDisplayedMnemonicIndex(4);
  6. predefinedPlaformDefaultButton.addActionListener(eventHandler);
  7. }
  8. return predefinedPlaformDefaultButton;
  9. }

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

  1. private JButton getPredefinedSpeedButton() {
  2. if (predefinedSpeedButton == null) {
  3. predefinedSpeedButton = new JButton("Speed");
  4. predefinedSpeedButton.setMnemonic('p');
  5. predefinedSpeedButton.setDisplayedMnemonicIndex(1);
  6. predefinedSpeedButton.addActionListener(eventHandler);
  7. }
  8. return predefinedSpeedButton;
  9. }

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

  1. private JButton getEnableAllViewOptionsButton() {
  2. if (enableAllViewOptionsButton == null) {
  3. enableAllViewOptionsButton = new JButton("Enable all");
  4. enableAllViewOptionsButton.setMnemonic('a');
  5. enableAllViewOptionsButton.setDisplayedMnemonicIndex(7);
  6. enableAllViewOptionsButton.addActionListener(eventHandler);
  7. }
  8. return enableAllViewOptionsButton;
  9. }

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

  1. public JButton getCloseButton() {
  2. if (closeButton == null) {
  3. closeButton = new JButton();
  4. closeButton.setText("Close");
  5. closeButton.setMnemonic('l');
  6. closeButton.setDisplayedMnemonicIndex(1);
  7. closeButton.addActionListener(this);
  8. }
  9. return closeButton;
  10. }

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

  1. private JButton getDefaultViewOptionsButton() {
  2. if (defaultViewOptionsButton == null) {
  3. defaultViewOptionsButton = new JButton("Defaults");
  4. defaultViewOptionsButton.setMnemonic('u');
  5. defaultViewOptionsButton.setDisplayedMnemonicIndex(4);
  6. defaultViewOptionsButton.addActionListener(eventHandler);
  7. }
  8. return defaultViewOptionsButton;
  9. }

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

  1. private JButton getDisableAllViewOptionsButton() {
  2. if (disableAllViewOptionsButton == null) {
  3. disableAllViewOptionsButton = new JButton("Disable all");
  4. disableAllViewOptionsButton.setMnemonic('i');
  5. disableAllViewOptionsButton.setDisplayedMnemonicIndex(1);
  6. disableAllViewOptionsButton.addActionListener(eventHandler);
  7. }
  8. return disableAllViewOptionsButton;
  9. }

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

  1. private JButton getRemoveAllButton() {
  2. if (removeAllButton == null) {
  3. removeAllButton = new JButton();
  4. removeAllButton.setText("<- Remove All");
  5. removeAllButton.setMnemonic('v');
  6. removeAllButton.setDisplayedMnemonicIndex(7);
  7. removeAllButton.addActionListener(eventHandler);
  8. }
  9. return removeAllButton;
  10. }

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

  1. /**
  2. * Sets the mnemonic index for the open the file chooser dialog button.
  3. * <p>
  4. * <h2>AWT Thread</h2>
  5. * <p>
  6. * Should be called in the AWT thread.
  7. *
  8. * @param index
  9. * the mnemonic index.
  10. */
  11. public void setButtonMnemonicIndex(int index) {
  12. this.buttonMnemonicIndex = index;
  13. getOpenFileChooser().setDisplayedMnemonicIndex(index);
  14. }

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

  1. /**
  2. * Return the restartButton
  3. *
  4. * @return JButton
  5. */
  6. private JButton getRestartButton() {
  7. if (restartButton == null) {
  8. restartButton = new JButton("Restart");
  9. restartButton.setMnemonic('t');
  10. restartButton.setDisplayedMnemonicIndex(3);
  11. restartButton.setHorizontalTextPosition(SwingConstants.CENTER);
  12. restartButton.setVerticalTextPosition(SwingConstants.BOTTOM);
  13. restartButton.addActionListener(eventHandler);
  14. restartButton.setEnabled(false);
  15. }
  16. return restartButton;
  17. }

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

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

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

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

相关文章

JButton类方法