本文整理汇总了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();
}
}
示例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);
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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
}
}
示例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);
}
}
示例8: actionPerformed
import java.awt.event.ActionEvent; //导入方法依赖的package包/类
public void actionPerformed( ActionEvent e )
{
if( e.getActionCommand() == "pass" )
{
DragEventSource.pass();
}
else
{
DragEventSource.fail();
}
}
示例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;
}
}
示例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);
}
}
示例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);
}
}
示例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
}
}
示例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();
}
}
示例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();
}
}
示例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;
}
}