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


Java ActionListener.actionPerformed方法代码示例

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


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

示例1: LaunchButton

import java.awt.event.ActionListener; //导入方法依赖的package包/类
public LaunchButton(String text, String textAttribute, String hotkeyAttribute, String iconAttribute, final ActionListener al) {
  super(text);
  nameAtt = textAttribute;
  keyAtt = hotkeyAttribute;
  iconAtt = iconAttribute;
  iconConfig = new IconConfigurer(iconAtt, null, null);
  setAlignmentY(0.0F);
  keyListener = new NamedKeyStrokeListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      if (isEnabled() && getParent() != null && getParent().isShowing()) {
        al.actionPerformed(e);
      }
    }
  });
  if (al != null) {
    GameModule.getGameModule().addKeyStrokeListener(keyListener);
    addActionListener(al);
  }
  setFocusable(false);
  checkVisibility();
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:22,代码来源:LaunchButton.java

示例2: actionPerformed

import java.awt.event.ActionListener; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent evt) {
    ActionListener src = (ActionListener)ref.get();
    if (src != null) {
        src.actionPerformed(evt);

    } else { // source listener was garbage collected
        if (evt.getSource() instanceof Timer) {
            Timer timer = (Timer)evt.getSource();
            timer.removeActionListener(this);

            if (stopTimer) {
                timer.stop();
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:WeakTimerListener.java

示例3: processKeyBinding

import java.awt.event.ActionListener; //导入方法依赖的package包/类
@Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
    try {
        return super.processKeyBinding(ks, e, condition, pressed);
    } finally {
        //Fix for #166154: passes Enter kb action to dialog
        if (e.getKeyCode() == KeyEvent.VK_ENTER) {
            if (descriptor!=null) {
                ActionListener al = descriptor.getButtonListener();
                if (al!=null) {
                    al.actionPerformed(new ActionEvent(this,
                                                        ActionEvent.ACTION_PERFORMED,
                                                        "OK",           //NOI18N
                                                        e.getWhen(),
                                                        e.getModifiers()));
                }
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:OLCustomizer.java

示例4: actionPerformed

import java.awt.event.ActionListener; //导入方法依赖的package包/类
public void actionPerformed( ActionEvent e ) {
            for (ActionListener al : uiProperties.getOptionListeners()) {
                al.actionPerformed(e);
            }

//#95952 some users experience this assertion on a fairly random set of changes in 
// the customizer, that leads me to assume that a project can be already marked
// as modified before the project customizer is shown. 
//            assert !ProjectManager.getDefault().isModified(project) : 
//                "Some of the customizer panels has written the changed data before OK Button was pressed. Please file it as bug."; //NOI18N
            // Close & dispose the the dialog
            Dialog dialog = project2Dialog.get(project);
            if ( dialog != null ) {
                dialog.setVisible(false);
                dialog.dispose();
            }
        }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:CustomizerProviderImpl.java

示例5: actionPerformed

import java.awt.event.ActionListener; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent ev, List<? extends Object> data, Provider everything) {
    String clazz = (String) delegate.get("injectable"); // NOI18N
    ClassLoader l = Lookup.getDefault().lookup(ClassLoader.class);
    if (l == null) {
        l = Thread.currentThread().getContextClassLoader();
    }
    if (l == null) {
        l = Actions.class.getClassLoader();
    }
    try {
        Class<?> clazzC = Class.forName(clazz, true, l);
        Constructor c = clazzC.getConstructor(List.class);
        ActionListener action = (ActionListener) c.newInstance(data);
        action.actionPerformed(ev);
    } catch (Exception ex) {
            Exceptions.printStackTrace(ex);
        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:InjectorAny.java

示例6: raiseActionListenerEvent

import java.awt.event.ActionListener; //导入方法依赖的package包/类
private void raiseActionListenerEvent()
{
	ActionEvent event = new ActionEvent(this, 0, null);
	for( ActionListener l : listeners.getListeners(ActionListener.class) )
	{
		l.actionPerformed(event);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:9,代码来源:MultipleFinderControl.java

示例7: selectProjectAtIndex

import java.awt.event.ActionListener; //导入方法依赖的package包/类
private void selectProjectAtIndex(int index) {
    if (index >= 0 && index < getModel().getSize()) {
        Object value = getModel().getElementAt(index);
        if (value instanceof ListNode) {
            ActionListener al = ((ListNode)value).getDefaultAction();
            if (al != null) {
                al.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "")); // NOI18N
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:SelectionList.java

示例8: actionPerformed

import java.awt.event.ActionListener; //导入方法依赖的package包/类
private void actionPerformed(ActionEvent e, ProjectCustomizer.Category[] categs) {
    for (ProjectCustomizer.Category category : categs) {
        ActionListener list = category.getOkButtonListener();
        if (list != null) {
            list.actionPerformed(e);// XXX maybe create new event
        }
        if (category.getSubcategories() != null) {
            actionPerformed(e, category.getSubcategories());
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:CustomizerDialog.java

示例9: getIterators

import java.awt.event.ActionListener; //导入方法依赖的package包/类
private AttributedCharacterIterator[] getIterators(Document document, int start, int end) {
        ActionListener action = (ActionListener) Lookup.getDefault().lookup(ActionListener.class);
//out();
//out("Action: " + action);
//out();
        if (action == null) {
            return null;
        }
        if ( !action.getClass().getName().contains(".print.")) { // NOI18N
            return null;
        }
        List<Object> source = new ArrayList<Object>();
        source.add(document);
        source.add(Integer.valueOf(start));
        source.add(Integer.valueOf(end));
        ActionEvent event = new ActionEvent(source, 0, null);
        action.actionPerformed(event);
        Object object = event.getSource();

        if ( !(object instanceof List)) {
            return null;
        }
        List list = (List) object;

        if (list.size() != 2*2) {
            return null;
        }
        Object param = list.get(1 + 2);

        if ( !(param instanceof AttributedCharacterIterator[])) {
            return null;
        }
        return (AttributedCharacterIterator[]) param;
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:EditorProvider.java

示例10: postActionEvent

import java.awt.event.ActionListener; //导入方法依赖的package包/类
public void postActionEvent( TabActionEvent event ) {
    List<ActionListener> list;
    synchronized( this ) {
        if( actionListenerList == null ) {
            return;
        }
        list = Collections.unmodifiableList( actionListenerList );
    }
    for( ActionListener l : list ) {
        l.actionPerformed( event );
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:Controller.java

示例11: fireControlActionCommand

import java.awt.event.ActionListener; //导入方法依赖的package包/类
private void fireControlActionCommand(String command) {
    ArrayList<ActionListener> listeners;
    synchronized (this) {
        listeners = new ArrayList<ActionListener>(controlListeners);
    }
    ActionEvent evt = new ActionEvent(this, 0, command);
    for (ActionListener l: listeners) {
        l.actionPerformed(evt);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:MergePanel.java

示例12: fireActionEvent

import java.awt.event.ActionListener; //导入方法依赖的package包/类
/**
 * Fire action event.
 */
protected void fireActionEvent() {
	ActionEvent event = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, this.getLink());
	for (ActionListener l : actionListenerList) {
		l.actionPerformed(event);
	}
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:10,代码来源:JHyperLink.java

示例13: mouseClicked

import java.awt.event.ActionListener; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent e)
{
	if( e.getSource() == this && isEnabled() )
	{
		ActionEvent event = new ActionEvent(this, 0, null);
		for( ActionListener listener : listenerList.getListeners(ActionListener.class) )
		{
			listener.actionPerformed(event);
		}
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:13,代码来源:JLinkButton.java

示例14: notifyStopped

import java.awt.event.ActionListener; //导入方法依赖的package包/类
private void notifyStopped() {
    for (ActionListener actionListener : actionListeners) {
        actionListener.actionPerformed(new ActionEvent(this,
                ActionEvent.ACTION_PERFORMED, ANIMATION_STOPPED));
    }
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:7,代码来源:DeclarationPanel.java

示例15: fireActionEvent

import java.awt.event.ActionListener; //导入方法依赖的package包/类
public void fireActionEvent() {
  for (ActionListener l : actionListeners) {
    l.actionPerformed(new ActionEvent(this, 0, null));
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:6,代码来源:PropertySheet.java


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