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

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

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

JButton.setMnemonic介绍

暂无

代码示例

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

private JButton createGoButton() {
  JButton b = new JButton("Go");
  b.setMnemonic('g');
  b.addActionListener(new ShowListener());
  b.addActionListener(new XPathListener());
  b.addActionListener(new DFAListener());
  b.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      saveSettings();
    }
  });
  return b;
}

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

final JButton openFileButton = new JButton(new FileSelectionAction());
openFileButton.setMnemonic(KeyEvent.VK_S);
openFileButton.setText("Open File");
final JButton reloadFileButton = new JButton(reloadAction);
reloadFileButton.setMnemonic(KeyEvent.VK_R);
reloadFileButton.setText("Reload File");

代码示例来源:origin: wiztools/rest-client

jp_north.setLayout(new FlowLayout(FlowLayout.LEFT));
jb_file.setToolTipText("Load from file");
jb_file.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent e) {
jp_north.add(jb_file);
jb_help.setToolTipText("Help");
jb_help.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent e) {
jb_add.setMnemonic('a');
getRootPane().setDefaultButton(jb_add);
jb_add.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent event) {
jb_cancel.setMnemonic('c');
jb_cancel.addActionListener(new ActionListener() {
  @Override

代码示例来源:origin: wiztools/rest-client

private void initComponents() {
  JPanel jp = new JPanel();
  jp.setLayout(new BorderLayout());
  jta_error = new JTextArea(10, 40);
  jta_error.setEditable(false);
  JScrollPane jsp = new JScrollPane(jta_error);
  jp.add(jsp, BorderLayout.CENTER);
  
  JPanel jp_south = new JPanel();
  jp_south.setLayout(new FlowLayout(FlowLayout.CENTER));
  
  jb_ok = new JButton("Ok");
  jb_ok.setMnemonic('o');
  getRootPane().setDefaultButton(jb_ok);
  jb_ok.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent event) {
      jb_okActionPerformed(event);
    }
  });
  jp_south.add(jb_ok);
  
  jp.add(jp_south, BorderLayout.SOUTH);
  this.setContentPane(jp);
  pack();
}

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

JButton button = new JButton("Alter Today");
button.setMnemonic('T');
// or button.setMnemonic(6);
// or button.setMnemonic(KeyEvent.VK_T);

代码示例来源:origin: wiztools/rest-client

jb_generate.setMnemonic('g');
getRootPane().setDefaultButton(jb_generate);
jb_generate.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent event) {
    actionGenerate(event);
jb_cancel.setMnemonic('c');
jb_cancel.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent event) {
    actionCancel(event);

代码示例来源:origin: wiztools/rest-client

JButton jb_ok = new JButton("Ok");
jb_ok.setMnemonic('o');
getRootPane().setDefaultButton(jb_ok);
jb_ok.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent arg0) {
JButton jb_cancel = new JButton("Cancel");
jb_cancel.setMnemonic('c');
jb_cancel.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent arg0) {

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

JButton cor =new JButton();
 cor.setText("Coor");
 cor.setMnemonic(KeyEvent.VK_C);
 mainframe.add(cor);
 window.getContentPane().add(mainframe);
 window.pack();
 window.setVisible(true);

代码示例来源:origin: wiztools/rest-client

jtf_archive.setEditable(false);
jp_center_file.add(jtf_archive);
jb_archive_browse.setMnemonic('b');
jb_archive_browse.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent e) {
jb_next.setMnemonic('n');
getRootPane().setDefaultButton(jb_next);
jb_next.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent e) {
jb_cancel.setMnemonic('c');
jb_cancel.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent e) {

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

final JButton exitButton = new JButton("Exit");
exitButton.setMnemonic('x');
exitButton.addActionListener(ExitAction.INSTANCE);
gridbag.setConstraints(exitButton, c);
add(exitButton);
final JButton clearButton = new JButton("Clear");
clearButton.setMnemonic('c');
clearButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent aEvent) {
      aModel.clear();
final JButton toggleButton = new JButton("Pause");
toggleButton.setMnemonic('p');
toggleButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent aEvent) {
      aModel.toggle();

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

JButton btnTesting = new JButton("Testing");
btnTesting.setMnemonic('T');

代码示例来源:origin: apache/felix

public MyButton(char c, String iconName, String ttt, NodesTree listener, JPanel panel) {
  super(new ImageIcon(Toolkit.getDefaultToolkit().getImage(bc.getBundle().getResource("images/"+iconName))));
  super.setMnemonic(c);
  super.setToolTipText(ttt);
  super.setBorder(null);
  super.setPreferredSize(new Dimension(W, H));
  super.addActionListener(listener);
  panel.add(this);
 }
}

代码示例来源:origin: wiztools/rest-client

JButton jb_ok = new JButton("Ok");
jb_ok.setMnemonic('o');
jb_ok.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent arg0) {

代码示例来源:origin: apache/felix

private JPanel createButtonPanel() {
 JPanel panel = new JPanel(new FlowLayout());
 panel.add(m_startAllButton = new JButton("Start all"));
 panel.add(m_infoButton = new JButton("Info"));
 m_startAllButton.setMnemonic('S');
 m_infoButton.setMnemonic('I');
 return panel;
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui

protected JButton buildButton(final BuIcon _ic, final String _lb, final String _com, final String _toolTip,
  final int _mnemonic) {
 final JButton r = new BuButton(_ic);
 r.setText(_lb);
 r.setMnemonic(_mnemonic);
 r.setActionCommand(_com);
 r.setToolTipText(_toolTip);
 r.addActionListener(this);
 return r;
}

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

JButton browseButton = new JButton("Browse");
browseButton.setMnemonic('b');
browseButton.addActionListener(new BrowseListener());
goButton = new JButton("Go");
goButton.setMnemonic('g');
goButton.addActionListener(new GoListener());
cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new CancelListener());

代码示例来源:origin: apache/felix

private JPanel createBRUrlPanel(){
 JPanel panel=new JPanel(new FlowLayout());
 panel.add(new JLabel("URL(s)"));
 panel.add(m_urlField = new JTextField(20));
 panel.add(m_refreshButton = new JButton("Refresh"));
 m_refreshButton.setMnemonic('I');
 return panel;
}

代码示例来源:origin: MegaMek/megamek

private JPanel setupControlsPanel() {
  JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 2, 2));
  loadButton.addActionListener(this);
  loadButton.setMnemonic(loadButton.getText().charAt(0));
  panel.add(loadButton);
  saveButton.addActionListener(this);
  saveButton.setMnemonic(saveButton.getText().charAt(0));
  panel.add(saveButton);
  okayButton.addActionListener(this);
  okayButton.setMnemonic(okayButton.getText().charAt(0));
  panel.add(okayButton);
  return panel;
}

代码示例来源:origin: wiztools/rest-client

JButton jb_ok = new JButton("Ok");
this.getRootPane().setDefaultButton(jb_ok);
jb_ok.setMnemonic('o');
jb_ok.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent arg0) {
JButton jb_cancel = new JButton("Cancel");
jb_cancel.setMnemonic('c');
jb_cancel.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent arg0) {

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javaee-project

private JButton createButton(String labelId, String labelMnemonicId, String mnemonicId) {
  JButton button = new JButton(NbBundle.getMessage(ProjectImportLocationWizardPanel.class, labelId));
  button.getAccessibleContext().setAccessibleDescription(
      NbBundle.getMessage(ProjectImportLocationWizardPanel.class, labelMnemonicId));
  button.setMnemonic(NbBundle.getMessage(ProjectImportLocationWizardPanel.class, mnemonicId).charAt(0));
  return button;
}

相关文章

JButton类方法