本文整理了Java中javax.swing.JButton.getActionCommand()
方法的一些代码示例,展示了JButton.getActionCommand()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JButton.getActionCommand()
方法的具体详情如下:
包路径:javax.swing.JButton
类名称:JButton
方法名:getActionCommand
暂无
代码示例来源:origin: magefree/mage
private void checkPopupMenu(MouseEvent me) {
if (me.isPopupTrigger()
&& originalId != null) { // only Yes/No requests from abilities can be automated
JButton source = (JButton) me.getSource();
if (source.getActionCommand().startsWith(QUESTION.toString())) {
showPopupMenu(me.getComponent(), source.getActionCommand());
me.consume();
}
}
}
代码示例来源:origin: stackoverflow.com
public void actionPerformed(ActionEvent e) {
JButton src = (JButton) e.getSource();
if(src.getActionCommand().equals("Yes")) {
yesCount++;
} else {
noCount++;
}
label.setText("Difference: " + (yesCount - noCount));
}
代码示例来源:origin: stackoverflow.com
@Override
public void actionPerformed(ActionEvent e) {
JButton button = (JButton) e.getSource();
String actionCommand = button.getActionCommand();
// ... rest of method
}
代码示例来源:origin: stackoverflow.com
public void actionPerformed(ActionEvent e)
{
JButton source = (JButton)e.getSource();
display.replaceSelection( source.getActionCommand() );
}
代码示例来源:origin: stackoverflow.com
@Override
public void actionPerformed(ActionEvent e) {
JButton b = (JButton) e.getSource();
txt.replaceSelection(b.getActionCommand());
}
代码示例来源:origin: iTransformers/netTransformer
@Override
public void actionPerformed(ActionEvent e) {
if (nextButton.getActionCommand().equals("GO")) {
DiscoveryWizardDialog.this.go();
}
}
});
代码示例来源:origin: stackoverflow.com
button.setActionCommand("-");
button.addActionListener(this);
public void actionPerformed(ActionEvent me){
JButton button =(JButton)me.getSource();
if(button.getActionCommand().equals("-"))
//corresponding action to be taken
}
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu
public static void setEnabledForAction
(JButton _item, String _action, boolean _state)
{
if(_item==null) return;
if(_item.getActionCommand().equals(_action))
_item.setEnabled(_state);
}
代码示例来源:origin: org.jspresso.framework/jspresso-ulc-components-client
public void actionPerformed(ActionEvent evt) {
if (evt.getSource() instanceof JButton) {
triggerAction(index, ((JButton) evt.getSource()).getActionCommand());
// sendActionText(((JButton) evt.getSource()).getActionCommand());
} else {
sendActionText();
}
}
};
代码示例来源:origin: stackoverflow.com
JButton source = (JButton)e.getSource();
if ("1".equals(source.getActionCommand()))
代码示例来源:origin: stackoverflow.com
btnNumber= new JNumber(""+(a+1));
btnNumber.setActionCommand(""+(a+1));
btnNumber.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JButton button = (JButton)evt.getSource();
int num = Integer.parseInt(button.getActionCommand());
System.out.println(num);
}
});
代码示例来源:origin: nroduit/Weasis
private static boolean checkButtonCommand(String cmd, JButton button) {
return (button == null) ? false : cmd.equals(button.getActionCommand());
}
代码示例来源:origin: org.jspresso/jspresso-ulc-components-client
public void actionPerformed(ActionEvent evt) {
if (evt.getSource() instanceof JButton) {
triggerAction(index, ((JButton) evt.getSource()).getActionCommand());
// sendActionText(((JButton) evt.getSource()).getActionCommand());
} else {
sendActionText();
}
}
};
代码示例来源:origin: stackoverflow.com
ImageIcon ic=new ImageIcon("C:/image.png");
JButton btn=new JButton(ic);
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
JButton b = (JButton)ae.getSource();
JOptionPane.showMessageDialog(null,"È stato premuto"+b.getActionCommand());
}
});
代码示例来源:origin: stackoverflow.com
public class AddDigitAction extends TextAction
{
public void actionPerformed(ActionEvent e)
{
JButton button = (JButton)e.getSource();
String digit = button.getActionCommand();
JTextComponent target = getTextComponent(e);
target.replaceSelection(digit);
}
代码示例来源:origin: stackoverflow.com
class MyMouseListener extends MouseAdapter
{
@Override
public void mousePressed(MouseEvent me)
{
JButton jb=(JButton)me.getSource();
String str=jb.getActionCommand();
if(str.equals("Resume"))
System.out.println("Resumed");
.....
.....
}
}
JButton resume=new JButton("Resume");
resume.addMouseListener(new MyMouseListener());
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
/**
*
* @return Current state (enabled/disabled) of Toolbar button
*/
private Map<String, Boolean> getCurrentButtonsStates() {
Component[] components = getComponents();
Map<String, Boolean> buttonStates = new HashMap<>(components.length);
for (Component component : components) {
if (component instanceof JButton) {
JButton button = (JButton) component;
buttonStates.put(button.getActionCommand(), Boolean.valueOf(button.isEnabled()));
}
}
return buttonStates;
}
代码示例来源:origin: uk.ac.gate.plugins/tools
/**
* Create a parent node for all selected non-terminal nodes
*/
protected STreeNode createParentNode(String text, Annotation annot) {
STreeNode parentNode = new STreeNode(annot);
long level = -1;
for (Iterator<JButton> i = selection.iterator(); i.hasNext(); ) {
JButton button = i.next();
Integer id = Integer.valueOf(button.getActionCommand());
STreeNode child = nonTerminals.get(id);
if (level < child.getLevel())
level = child.getLevel();
parentNode.add(child);
} //for
parentNode.setLevel(level+1);
parentNode.setUserObject(text);
return parentNode;
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui
private JMenuItem initFrom(final JButton _bt) {
if (_bt == null) {
return null;
}
final JMenuItem it = new JMenuItem();
it.setIcon(_bt.getIcon());
it.setText(_bt.getText());
it.setToolTipText(_bt.getToolTipText());
it.setEnabled(_bt.isEnabled());
it.setActionCommand(_bt.getActionCommand());
it.addActionListener(this);
return it;
}
代码示例来源:origin: freeplane/freeplane
public void actionPerformed(ActionEvent e) {
try {
Controller.getCurrentController().getViewController().openDocument(
new URL( ((JButton) e.getSource()).getActionCommand()) );
}
catch (final MalformedURLException ex) {
UITools.errorMessage(TextUtils.getText("url_error") + "\n" + ex);
}
catch (final Exception ex) {
UITools.errorMessage(ex);
}
}
};
内容来源于网络,如有侵权,请联系作者删除!