当前位置: 首页>>代码示例>>Java>>正文


Java ActionEvent.getActionCommand方法代码示例

本文整理汇总了Java中java.awt.event.ActionEvent.getActionCommand方法的典型用法代码示例。如果您正苦于以下问题:Java ActionEvent.getActionCommand方法的具体用法?Java ActionEvent.getActionCommand怎么用?Java ActionEvent.getActionCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.event.ActionEvent的用法示例。


在下文中一共展示了ActionEvent.getActionCommand方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import java.awt.event.ActionEvent; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
    try {
        // Just for logger
        // JOptionPane.showConfirmDialog(null, e.getActionCommand());

        switch (e.getActionCommand()) {

            case SELECTALL:
                textArea.selectAll();
                textArea.requestFocusInWindow();
                break;

            case COPY:
                textArea.copy();
                break;
            case SAVETOFILE:
                // TODO
                break;

        }
    } catch (Exception exc) {
        exc.printStackTrace();
    }
}
 
开发者ID:phweda,项目名称:MFM,代码行数:26,代码来源:MFMOptionPane.java

示例2: actionPerformed

import java.awt.event.ActionEvent; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void actionPerformed(ActionEvent ae) {
    final String command = ae.getActionCommand();
    if (ANIMATION_STOPPED.equals(command)) {
        Timer t = new Timer(FINISH_DELAY, (x) -> {
                getGUI().removeFromCanvas(DeclarationPanel.this);
            });
        t.setRepeats(false);
        t.start();
    } else {
        super.actionPerformed(ae);
    }
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:17,代码来源:DeclarationPanel.java

示例3: actionPerformed

import java.awt.event.ActionEvent; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
    String action = e.getActionCommand();
    if (action.equals(Vars.PROP_NEW)) {
        EstadosCadastro estadosCadastro = new EstadosCadastro(estados);
        if (VerificaFrame.verificaFrame(estados.getPainel(), estadosCadastro)) {
            VerificaFrame.exibirFrame(estados.getPainel(), estadosCadastro);
            estados.addChild(estadosCadastro);
        }
    } else if (action.equals(Vars.PROP_REMOVE)) {
        JTable tabela = estados.getTable();
        String sigla = tabela.getValueAt(tabela.getSelectedRow(), 1).toString();
        br.com.secharpe.dao.EstadoDAO estDAO = new br.com.secharpe.dao.EstadoDAO();
        estDAO.delete(sigla);
        estados.refreshTable();
    } else if (action.equals(Vars.PROP_CLOSE)) {
        estados.dispose();
    }
}
 
开发者ID:luandr,项目名称:ProjetoERP,代码行数:20,代码来源:EstadosViewActionListener.java

示例4: actionPerformed

import java.awt.event.ActionEvent; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent evt)
{
    String command = evt.getActionCommand();
    if(command.equals("ok-command"))
    {
        okPressed = true;
        setVisible(false);
        dispose();
    } else
    if(command.equals("cancel-command"))
    {
        okPressed = false;
        setVisible(false);
        dispose();
    }
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:17,代码来源:OkCancelDialog.java

示例5: actionPerformed

import java.awt.event.ActionEvent; //导入方法依赖的package包/类
@Override
    public void actionPerformed(ActionEvent e) {
        String action = e.getActionCommand();
        br.com.secharpe.model.Unidades unidade = new br.com.secharpe.model.Unidades();
        if (action.equals(Vars.PROP_SAVE)) {
            if ((!cadastro.getNome().equals("")) || (!cadastro.getSigla().equals(""))) {
                br.com.secharpe.dao.UnidadeDAO und = new br.com.secharpe.dao.UnidadeDAO();
                System.out.println(cadastro.getUnidade().toString());
                unidade = cadastro.getUnidade();
                und.insert(unidade);
                cadastro.getUnidadeView().refreshTable();
                System.out.println(cadastro.getUnidade().toString());
//                br.com.secharpe.view.Unidades cad = cadastro.getUnidadeView();
                cadastro.dispose();
//                cad.requestFocus();
            } else {
                System.out.println("Insira corretamente as informações!");
            }
        } else if (action.equals(Vars.PROP_CLOSE)) {
            cadastro.dispose();
        }
    }
 
开发者ID:luandr,项目名称:ProjetoERP,代码行数:23,代码来源:UnidadesActionListener.java

示例6: actionPerformed

import java.awt.event.ActionEvent; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent event)
         {
          
          String command = event.getActionCommand();

        if(command.equals("New User Registration with Voice Record"))
         {  
           JOptionPane.showMessageDialog(null, "Link to New USER Entry page...\n");
           new_User.init();
           Frame frame1 = new JFrame();  // add frame 1
           frame1.setVisible(true);
           frame1.add(new_User);        // add all fields to frame 1
           frame1.setSize(500,300);     // add set dimension size to frame 1
         }
          
          if(command.equals("Daily Attendance"))
            {  
              JOptionPane.showMessageDialog(null, "Check for User access permission ...\n");             
              check_attendance.init();
              JFrame frame2 = new JFrame();    // add frame 2
              frame2.setVisible(true);
              frame2.add(check_attendance);
              frame2.setSize(500,300);        // add set dimension size to frame 2      
            }
}
 
开发者ID:karanjadhav2508,项目名称:kqsse17,代码行数:26,代码来源:VoiceRecognitionApplet.java

示例7: actionPerformed

import java.awt.event.ActionEvent; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
    String arg = e.getActionCommand();

    if ("first".equals(arg)) {
        ((CardLayout) cards.getLayout()).first(cards);
    } else if ("next".equals(arg)) {
        ((CardLayout) cards.getLayout()).next(cards);
    } else if ("previous".equals(arg)) {
        ((CardLayout) cards.getLayout()).previous(cards);
    } else if ("last".equals(arg)) {
        ((CardLayout) cards.getLayout()).last(cards);
    } else {
        ((CardLayout) cards.getLayout()).show(cards, arg);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:CardTest.java

示例8: actionPerformed

import java.awt.event.ActionEvent; //导入方法依赖的package包/类
public void actionPerformed( ActionEvent e )
{
    if( e.getActionCommand() == "pass" )
    {
        DragEventSource.pass();
    }
    else
    {
        DragEventSource.fail();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:DragEventSource.java

示例9: actionPerformed

import java.awt.event.ActionEvent; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent ae) {
    switch (ae.getActionCommand()) {
        case "Show Offset":
            findOffset();
            break;
        case "FindOnScreenTimer":
            findOnScreen();
            break;
        case "Find on Screen":
            imageOR.getTestDesign().getsMainFrame().setExtendedState(JFrame.ICONIFIED);
            findOnScreenTimer.start();
            break;
        case "Show Property Editor":
            showEditor();
            break;
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:19,代码来源:ImageORTable.java

示例10: actionPerformed

import java.awt.event.ActionEvent; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
	String cmd = e.getActionCommand();

	if (cmd.equals("algo")) {
		new MyProgressBarDialog(this, new TestAlgorithm());
	} else if (cmd.equals("about")) {
		String html = "<html><h1>" + getTitle() + "</h1>";
		html += "WWW: http://mulavito.sf.net";
		html += "<h3>Demo Authors</h3>";
		html += "<ul>";
		html += "<li>Michael Duelli";
		html += "</ul>";
		html += "</html>";
		JOptionPane.showMessageDialog(this, html);
	}
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:18,代码来源:ProgressBarDemo.java

示例11: actionPerformed

import java.awt.event.ActionEvent; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {
    String numStr = e.getActionCommand();
    MetalTheme selectedTheme = themes[Integer.parseInt(numStr)];
    MetalLookAndFeel.setCurrentTheme(selectedTheme);
    try {
        UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (Exception ex) {
        System.out.println("Failed loading Metal");
        System.out.println(ex);
    }

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:MetalThemeMenu.java

示例12: actionPerformed

import java.awt.event.ActionEvent; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    if (CMD_DIALOG.equals(command)) {
        JDialog dialog = new JDialog(this.frame, "Dialog"); // NON-NLS: dialog title
        dialog.setLocation(200, 0);
        show(dialog, CMD_CHOOSER);
    }
    else if (CMD_CHOOSER.equals(command)) {
        Object source = event.getSource();
        Component component = (source instanceof Component)
                ? (Component) source
                : null;

        JColorChooser.showDialog(component, "ColorChooser", Color.BLUE); // NON-NLS: title
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:Test4759934.java

示例13: actionPerformed

import java.awt.event.ActionEvent; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent evt) {
	JEditTextArea textArea = getTextArea(evt);
	String str = evt.getActionCommand();
	int repeatCount = textArea.getInputHandler().getRepeatCount();

	if (textArea.isEditable()) {
		StringBuffer buf = new StringBuffer();
		for (int i = 0; i < repeatCount; i++) {
			buf.append(str);
		}
		textArea.overwriteSetSelectedText(buf.toString());
	} else {
		textArea.getToolkit().beep();
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:17,代码来源:InputHandler.java

示例14: actionPerformed

import java.awt.event.ActionEvent; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent ev) {

        String s = ev.getActionCommand();

        if (s.equals("ConnectOk") || (ev.getSource() instanceof TextField)) {
            try {
                if (mURL.getText().indexOf('\u00AB') >= 0) {
                    throw new Exception("please specify db path");
                }

                mConnection = createConnection(mDriver.getText(),
                                               mURL.getText(),
                                               mUser.getText(),
                                               mPassword.getText());

                if (mName.getText() != null
                        && mName.getText().trim().length() != 0) {
                    ConnectionSetting newSetting =
                        new ConnectionSetting(mName.getText(),
                                              mDriver.getText(),
                                              mURL.getText(), mUser.getText(),
                                              mPassword.getText());

                    ConnectionDialogCommon.addToRecentConnectionSettings(
                        settings, newSetting);
                }

                dispose();
            } catch (java.io.IOException ioe) {
                dispose();
            } catch (Exception e) {
                e.printStackTrace();
                mError.setText(e.toString());
            }
        } else if (s.equals("ConnectCancel")) {
            dispose();
        }
    }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:39,代码来源:ConnectionDialog.java

示例15: actionPerformed

import java.awt.event.ActionEvent; //导入方法依赖的package包/类
/**
 * 事件处理
 */
@Override
public void actionPerformed(ActionEvent e) {
    switch(e.getActionCommand()){
    case "btnAddUserSetting": btnAddUserSetting_Click(e); break;
    case "btnUpdateUserSetting": btnUpdateUserSetting_Click(e); break;
    case "btnDeleteUserSetting": btnDeleteUserSetting_Click(e); break;
    case "btnStartAll": btnStartAll_Click(e); break;
    case "btnStopAll": btnStopAll_Click(e); break;
    case "btnStart": btnStart_Click(e); break;
    case "btnStop": btnStop_Click(e); break;
    case "mntmOpenUserTodayLog": mntmOpenUserTodayLog_Click(e); break;
    case "mntmOpenLogDir": mntmOpenLogDir_Click(e); break;
    case "mntmExit": mntmExit_Click(e); break;
    }
}
 
开发者ID:hulang1024,项目名称:PTEAssistant,代码行数:19,代码来源:MainFrame.java


注:本文中的java.awt.event.ActionEvent.getActionCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。