當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。