本文整理汇总了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();
}
示例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();
}
}
}
}
示例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()));
}
}
}
}
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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
}
}
}
}
示例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());
}
}
}
示例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;
}
示例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 );
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
示例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));
}
}
示例15: fireActionEvent
import java.awt.event.ActionListener; //导入方法依赖的package包/类
public void fireActionEvent() {
for (ActionListener l : actionListeners) {
l.actionPerformed(new ActionEvent(this, 0, null));
}
}