javax.swing.AbstractButton.getActionCommand()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(151)

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

AbstractButton.getActionCommand介绍

暂无

代码示例

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

private void loadSettings() {
  File file = new File(SETTINGS_FILE_NAME);
  if (file.exists()) {
    try (InputStream stream = Files.newInputStream(file.toPath())) {
      DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
      Document document = builder.parse(stream);
      Element settingsElement = document.getDocumentElement();
      Element codeElement = (Element) settingsElement.getElementsByTagName("code").item(0);
      Element xpathElement = (Element) settingsElement.getElementsByTagName("xpath").item(0);
      String code = getTextContext(codeElement);
      String languageVersion = codeElement.getAttribute("language-version");
      String xpath = getTextContext(xpathElement);
      String xpathVersion = xpathElement.getAttribute("version");
      codeEditorPane.setText(code);
      setLanguageVersion(LanguageRegistry.findLanguageVersionByTerseName(languageVersion));
      xpathQueryArea.setText(xpath);
      for (Enumeration<AbstractButton> e = xpathVersionButtonGroup.getElements(); e.hasMoreElements();) {
        AbstractButton button = e.nextElement();
        if (xpathVersion.equals(button.getActionCommand())) {
          button.setSelected(true);
          break;
        }
      }
    } catch (ParserConfigurationException | IOException | SAXException e) {
      e.printStackTrace();
    }
  }
}

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

display.replaceSelection( source.getActionCommand() );

代码示例来源:origin: org.fudaa.framework.ebli/ebli-common

public static int getAbstractButtonIndex(final String _actionCommand, final AbstractButton[] _buttons) {
 if ((_actionCommand == null) || (_buttons == null)) { return -1; }
 final int n = _buttons.length - 1;
 AbstractButton b;
 for (int i = n; i >= 0; i--) {
  b = _buttons[i];
  if (b != null && _actionCommand.equals(b.getActionCommand())) { return i; }
 }
 return -1;
}

代码示例来源:origin: org.fudaa.framework.ebli/ebli-common

/**
 * Renvoie le bouton dont l'actionCommand est egale a <code>_actionCommand</code>. Renvoie null si un des deux
 * parametres est nul.
 * 
 * @return le bouton de <code>_buttons</code> tel que <code>_actionCommand.equals(_buttons.getActionCommand)</code>.
 */
public static AbstractButton getAbstractButton(final String _actionCommand, final AbstractButton[] _buttons) {
 if ((_actionCommand == null) || (_buttons == null)) { return null; }
 final int n = _buttons.length - 1;
 AbstractButton b;
 for (int i = n; i >= 0; i--) {
  b = _buttons[i];
  if (b != null && _actionCommand.equals(b.getActionCommand())) { return b; }
 }
 return null;
}

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

public class ButtonAction{
  public static class AddInv implements ActionListener{
    private JTextArea text;
    public AddInv(JTextArea text) {
      this.text = text;
    }
    public void actionPerformed(ActionEvent e){
      AbstractButton inv = (AbstractButton)e.getSource();

      if(inv.getActionCommand().equals("SAVE")){
        invName = text.getText();                
        JOptionPane.showMessageDialog(null, invName);
      }   
    }
  }
}

代码示例来源:origin: net.sf.tinylaf/tinylaf

public void actionPerformed(ActionEvent e) {
    JMenuItem item = (JMenuItem)e.getSource();
    int index = Integer.parseInt(item.getActionCommand());
    
    openTheme(themes[index]);
  }
}

代码示例来源:origin: org.fudaa.framework.ebli/ebli-2d

private void setEnablePrefix(final String _prefix, final boolean _r) {
 for (int i = globalButtons_.size() - 1; i >= 0; i--) {
  final Object o = globalButtons_.get(i);
  if (o != null && ((AbstractButton) o).getActionCommand().startsWith(_prefix)) {
   ((AbstractButton) o).setEnabled(_r);
   if (!_r && o instanceof JToggleButton) {
    ((JToggleButton) o).setSelected(false);
   }
  }
 }
}

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

public void setButtonGroup(int rdValue, Enumeration elements ){
  while (elements.hasMoreElements()){
    AbstractButton button = (AbstractButton)elements.nextElement();
    if(Integer.parseInt(button.getActionCommand())==rdValue){
      button.setSelected(true);
    }
  }
}

代码示例来源:origin: antlr/antlrworks

protected AbstractButton getButtonWithActionCommand(ButtonGroup group, String actionCommand) {
  Enumeration<AbstractButton> elements = group.getElements();
  while (elements.hasMoreElements()) {
    AbstractButton button = elements.nextElement();
    if(button.getActionCommand().equalsIgnoreCase(actionCommand))
      return button;
  }
  return null;
}

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

public void setButtonGroup(int rdValue, Enumeration elements ){
  while (elements.hasMoreElements()){
    AbstractButton button = (AbstractButton)elements.nextElement();
    if(Integer.parseInt(button.getActionCommand())==rdValue){
      button.setSelected(true);
    }
  }
}

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

public void setButtonGroup(String rdValue, Enumeration elements ){
  while (elements.hasMoreElements()){
    AbstractButton button = (AbstractButton)elements.nextElement();
    if(button.getActionCommand()==rdValue){
      button.setSelected(true);
    }
  }
}

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

public void setButtonGroup(String rdValue, Enumeration elements ){
  while (elements.hasMoreElements()){
    AbstractButton button = (AbstractButton)elements.nextElement();
    if(button.getActionCommand()==rdValue){
      button.setSelected(true);
    }
  }
}

代码示例来源:origin: org.bitbucket.goalhub.simpleide/jedit

public int compare(AbstractButton o1, AbstractButton o2)
  {
    String name1 = o1.getActionCommand();
    String name2 = o2.getActionCommand();
    return StandardUtilities.compareStrings(
      jEdit.getProperty(name1 + ".title",""),
      jEdit.getProperty(name2 + ".title",""),
      true);
  }
} //}}}

代码示例来源:origin: org.seamless/seamless-swing

/**
 * Register an action that can be executed by this controller.
 *
 * @param source The prepared (== has action command assigned) action trigger source
 * @param action An actual action implementation.
 */
public void registerAction(AbstractButton source, DefaultAction action) {
  source.removeActionListener(this);
  source.addActionListener(this);
  this.actions.put(source.getActionCommand(), action);
}

代码示例来源:origin: net.java.abeille/abeille

public void actionPerformed(ActionEvent evt) {
    try {
      DefaultLookAndFeelManager lfm = (DefaultLookAndFeelManager) JETARegistry.lookup(DefaultLookAndFeelManager.COMPONENT_ID);
      if (lfm != null) {
        javax.swing.AbstractButton btn = (javax.swing.AbstractButton) evt.getSource();
        // the menu's action command will be the LookAndFeelInfo Id.
        setLookAndFeel(m_frame, m_runframe, lfm.findById(btn.getActionCommand()));
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: net.sf.tinylaf/tinylaf

public void actionPerformed(ActionEvent e) {
  AbstractButton b = (AbstractButton)e.getSource();
  
  if("copy".equals(b.getActionCommand())) {
    cp.createParameterSet();
    
    if(!pasteButton.isEnabled()) {
      pasteButton.setEnabled(true);
    }
  }
  else {	// "paste"
    cp.pasteParameters();
  }
}

代码示例来源:origin: undera/jmeter-plugins

public void modelToUI(AbstractDynamicThreadGroup tg) {
  logFile.setText(tg.getLogFilename());
  iterations.setText(tg.getIterationsLimit());
  concurrLimit.setText("1000");
  unitMinutes.setSelected(true);
  if (tg instanceof ArrivalsThreadGroup) {
    ArrivalsThreadGroup atg = (ArrivalsThreadGroup) tg;
    concurrLimit.setText(atg.getConcurrencyLimit());
  }
  Enumeration<AbstractButton> it = unitGroup.getElements();
  while (it.hasMoreElements()) {
    AbstractButton btn = it.nextElement();
    if (btn.getActionCommand().equals(tg.getUnit())) {
      btn.setSelected(true);
    }
  }
}

代码示例来源:origin: kg.apc/jmeter-plugins-casutg

public void modelToUI(AbstractDynamicThreadGroup tg) {
  logFile.setText(tg.getLogFilename());
  iterations.setText(tg.getIterationsLimit());
  concurrLimit.setText("1000");
  unitMinutes.setSelected(true);
  if (tg instanceof ArrivalsThreadGroup) {
    ArrivalsThreadGroup atg = (ArrivalsThreadGroup) tg;
    concurrLimit.setText(atg.getConcurrencyLimit());
  }
  Enumeration<AbstractButton> it = unitGroup.getElements();
  while (it.hasMoreElements()) {
    AbstractButton btn = it.nextElement();
    if (btn.getActionCommand().equals(tg.getUnit())) {
      btn.setSelected(true);
    }
  }
}

代码示例来源:origin: kg.apc/jmeter-plugins-standard

public void modelToUI(AbstractDynamicThreadGroup tg) {
  logFile.setText(tg.getLogFilename());
  iterations.setText(tg.getIterationsLimit());
  concurrLimit.setText("1000");
  unitMinutes.setSelected(true);
  if (tg instanceof ArrivalsThreadGroup) {
    ArrivalsThreadGroup atg = (ArrivalsThreadGroup) tg;
    concurrLimit.setText(atg.getConcurrencyLimit());
  }
  Enumeration<AbstractButton> it = unitGroup.getElements();
  while (it.hasMoreElements()) {
    AbstractButton btn = it.nextElement();
    if (btn.getActionCommand().equals(tg.getUnit())) {
      btn.setSelected(true);
    }
  }
}

代码示例来源:origin: undera/jmeter-plugins

@Override
public void configure(TestElement element) {
  super.configure(element);
  JSONPathAssertion jpAssertion = (JSONPathAssertion) element;
  jsonPath.setText(jpAssertion.getJsonPath());
  jsonValue.setText(jpAssertion.getExpectedValue());
  jsonValidation.setSelected(jpAssertion.isJsonValidationBool());
  expectNull.setSelected(jpAssertion.isExpectNull());
  invert.setSelected(jpAssertion.isInvert());
  isRegex.setSelected(jpAssertion.isUseRegex());
  Enumeration<AbstractButton> it = inputFormatGroup.getElements();
  while (it.hasMoreElements()) {
    AbstractButton btn = it.nextElement();
    if (btn.getActionCommand().equals(jpAssertion.getInputFormat())) {
      btn.setSelected(true);
    }
  }
}

相关文章

微信公众号

最新文章

更多

AbstractButton类方法