java.awt.event.ActionListener#actionPerformed()源码实例Demo

下面列出了java.awt.event.ActionListener#actionPerformed() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: netbeans   文件: PerformanceTestCase.java
private synchronized void stop(int round) throws Exception {
    ActionListener ss = (ActionListener) profiler;
    profiler = null;
    if (!profiling) {
        return;
    }
    FileObject wd = FileUtil.toFileObject(getWorkDir());
    String n = FileUtil.findFreeFileName(wd, "snapshot-" + round, "nps"); // NOI18N
    FileObject snapshot = wd.createData(n, "nps"); // NOI18N
    DataOutputStream dos = new DataOutputStream(snapshot.getOutputStream());
    ss.actionPerformed(new ActionEvent(dos, 0, "write")); // NOI18N
    dos.close();
    LOG.log(
            Level.WARNING, "Profiling snapshot taken into {0}", snapshot.getPath()
    );
}
 
源代码2 项目: netbeans   文件: CustomizerProviderImpl.java
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();
            }
        }
 
源代码3 项目: netbeans   文件: WeakTimerListener.java
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();
            }
        }
    }
}
 
源代码4 项目: netbeans   文件: ActionMapAction.java
private State handleKeyEvent (Widget widget, WidgetKeyEvent event, KeyStroke keyStroke) {
    if (keyStroke == null)
        return State.REJECTED;
    ActionListener action;
    if (actionMap != null && inputMap != null) {
        Object o = inputMap.get (keyStroke);
        action = o != null ? actionMap.get (o) : null;
    } else {
        JComponent view = widget.getScene ().getView ();
        action = view != null ? view.getActionForKeyStroke (keyStroke) : null;
    }
    if (action != null) {
        action.actionPerformed (new ActionEvent (widget, (int) event.getEventID (), null, event.getWhen (), event.getModifiers ())); // TODO - action-event command
        return State.CONSUMED;
    }
    return State.REJECTED;
}
 
源代码5 项目: netbeans   文件: OLCustomizer.java
@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()));
                }
            }
        }
    }
}
 
源代码6 项目: netbeans   文件: CustomizerProviderImpl.java
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();
            }
        }
 
源代码7 项目: netbeans   文件: CustomizerProviderImpl.java
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 = (Dialog)project2Dialog.get( project );
            if ( dialog != null ) {
                dialog.setVisible(false);
                dialog.dispose();
            }
        }
 
源代码8 项目: PacketProxy   文件: FilterComboBoxEditor.java
protected void fireActionEvent(String str) {
	Object listeners[] = listenerList.getListenerList();
	for (Object obj : listeners) {
		if (obj instanceof ActionListener) {
			ActionListener l = (ActionListener)obj;
	        ActionEvent actionEvent = new ActionEvent(editor, ActionEvent.ACTION_PERFORMED, editor.getText());
            l.actionPerformed(actionEvent);
		}
	}
}
 
源代码9 项目: FlatLaf   文件: FlatComboBoxUI.java
@Override
public void actionPerformed( ActionEvent e ) {
	ActionListener action = comboBox.getActionForKeyStroke( keyStroke );
	if( action != null ) {
		action.actionPerformed( new ActionEvent( comboBox, e.getID(),
			e.getActionCommand(), e.getWhen(), e.getModifiers() ) );
	}
}
 
源代码10 项目: ghidra   文件: DiffApplySettingsProvider.java
protected void applyFilterChanged() {
	if (adjustingApplyFilter) {
		return;
	}
	for (int i = 0; i < listenerList.size(); i++) {
		ActionListener listener = listenerList.get(i);
		listener.actionPerformed(new ActionEvent(this, 0, APPLY_FILTER_CHANGED_ACTION));
	}
}
 
源代码11 项目: netbeans   文件: SelectionList.java
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
            }
        }
    }
}
 
源代码12 项目: netbeans   文件: ResolveBrokenRuntimePlatform.java
/**
 * Creates new form ResolveMissingRuntimePlatform
 */
private ResolveBrokenRuntimePlatform(
        @NonNull final Type type,
        @NonNull final Project prj,
        @NonNull final Union2<String,RuntimePlatformProblemsProvider.InvalidPlatformData> data) {
    Parameters.notNull("type", type);   //NOI18N
    Parameters.notNull("prj", prj);   //NOI18N
    Parameters.notNull("data", data);   //NOI18N
    this.type = type;
    this.prj = prj;
    this.data = data;
    this.changeSupport = new ChangeSupport(this);
    initComponents();
    platforms.setRenderer(new PlatformRenderer());
    platforms.setModel(new DefaultComboBoxModel<JavaPlatform>());
    updatePlatforms();
    final ActionListener specificPlatformListener = new ActionListener() {
        @Override
        public void actionPerformed(@NullAllowed final ActionEvent e) {
            platforms.setEnabled(specificPlatform.isSelected());
            create.setEnabled(specificPlatform.isSelected());
            sourceLevelWarning.setEnabled(sourceLevel.isSelected());
            changeSupport.fireChange();
        }
    };
    specificPlatform.addActionListener(specificPlatformListener);
    projectPlatform.addActionListener(specificPlatformListener);
    sourceLevel.addActionListener(specificPlatformListener);
    specificPlatformListener.actionPerformed(null);
    projectPlatform.setSelected(true);
    if (type == Type.MISSING_PLATFORM) {
        sourceLevel.setVisible(false);
        sourceLevelWarning.setVisible(false);
    }
}
 
源代码13 项目: netbeans   文件: LinkButtonPanel.java
/**
 * Create listener that delegates mouse clicks on parenthesis to the button.
 */
private MouseListener createLabelMouseListener() {
    return new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (button.isEnabled()) {
                for (ActionListener al : button.getActionListeners()) {
                    al.actionPerformed(null);
                }
            }
        }
    };
}
 
源代码14 项目: Logisim   文件: MenuItemHelper.java
@Override
public void actionPerformed(ActionEvent event) {
	if (!listeners.isEmpty()) {
		ActionEvent e = new ActionEvent(menuItem, event.getID(), event.getActionCommand(), event.getWhen(),
				event.getModifiers());
		for (ActionListener l : listeners) {
			l.actionPerformed(e);
		}
	}
}
 
源代码15 项目: netbeans   文件: NBTabbedPane.java
/**
 * Used by Controller to post action events for selection and close
 * operations. If the event is consumed, the UI should take no action to
 * change the selection or close the tab, and will presume that the receiver
 * of the event is handling performing whatever action is appropriate.
 *
 * @param event The event to be fired
 */
protected final void postActionEvent( TabActionEvent event ) {
    List<ActionListener> list;
    synchronized( this ) {
        if( actionListenerList == null ) {
            return;
        }
        list = Collections.unmodifiableList( actionListenerList );
    }
    for( ActionListener l : list ) {
        l.actionPerformed( event );
    }
}
 
源代码16 项目: shogun   文件: TaskTrayTest.java
void click() {
    for (ActionListener actionListener : menu.getActionListeners()) {
        actionListener.actionPerformed(new ActionEvent(TaskTrayTest.class, 0, "dummy"));
    }
}
 
源代码17 项目: netbeans   文件: SortAttributePanel.java
private void fireEvent(ActionEvent e) {
    for (ActionListener listener : changeListeners) {
        listener.actionPerformed(e);
    }
}
 
源代码18 项目: netbeans   文件: NbPresenter.java
public void actionPerformed(ActionEvent evt) {
    boolean isAqua = "Aqua".equals (UIManager.getLookAndFeel().getID()) || //NOI18N
                    "true".equalsIgnoreCase (System.getProperty ("xtest.looks_as_mac"));

    Object pressedOption = evt.getSource();
    // handle ESCAPE
    if (ESCAPE_COMMAND.equals (evt.getActionCommand ())) {
        MenuElement[] selPath = MenuSelectionManager.defaultManager().getSelectedPath();
        // part of #130919 fix - handle ESC key well in dialogs with menus
        if (selPath == null || selPath.length == 0) {
            pressedOption = NotifyDescriptor.CLOSED_OPTION;
        } else {
            MenuSelectionManager.defaultManager().clearSelectedPath();
            return ;
        }
    } else {
        // handle buttons
        if (evt.getSource() == stdHelpButton) {
            showHelp(currentHelp);
            return;
        }

        Object[] options = descriptor.getOptions();
        if (isAqua && options != null) {
            Arrays.sort (options, NbPresenter.this);
        }

        if (
        options != null &&
        currentPrimaryButtons != null &&
        options.length == (currentPrimaryButtons.length -
            ((currentHelp != null) ? 1 : 0))
        ) {
            int offset = currentHelp != null && isAqua ?
                -1 : 0;
            for (int i = 0; i < currentPrimaryButtons.length; i++) {
                if (evt.getSource() == currentPrimaryButtons[i]) {
                    pressedOption = options[i + offset];
                }
            }
        }

        options = descriptor.getAdditionalOptions();
        if (isAqua && options != null) {
            Arrays.sort (options, NbPresenter.this);
        }

        if (
        options != null &&
        currentSecondaryButtons != null &&
        options.length == currentSecondaryButtons.length
        ) {
            for (int i = 0; i < currentSecondaryButtons.length; i++) {
                if (evt.getSource() == currentSecondaryButtons[i]) {
                    pressedOption = options[i];
                }
            }
        }

        if (evt.getSource() == stdYesButton) {
            pressedOption = NotifyDescriptor.YES_OPTION;
        } else if (evt.getSource() == stdNoButton) {
            pressedOption = NotifyDescriptor.NO_OPTION;
        } else if (evt.getSource() == stdCancelButton) {
            pressedOption = NotifyDescriptor.CANCEL_OPTION;
        } else if (evt.getSource() == stdClosedButton) {
            pressedOption = NotifyDescriptor.CLOSED_OPTION;
        } else if (evt.getSource() == stdOKButton) {
            pressedOption = NotifyDescriptor.OK_OPTION;
        }
    }

    descriptor.setValue(pressedOption);

    ActionListener al = getButtonListener();
    if (al != null) {

        if (pressedOption == evt.getSource()) {
            al.actionPerformed(evt);
        } else {
            al.actionPerformed(new ActionEvent(
            pressedOption, evt.getID(), evt.getActionCommand(), evt.getModifiers()
            ));
        }
    }

    Object[] arr = getClosingOptions();
    if (arr == null || pressedOption == NotifyDescriptor.CLOSED_OPTION) {
        // all options should close
        dispose();
    } else {
        java.util.List l = java.util.Arrays.asList(arr);

        if (l.contains(pressedOption)) {
            dispose();
        }
    }
}
 
源代码19 项目: netbeans   文件: OpenTaskAction.java
public void actionPerformed( ActionEvent e ) {
    if( !canOpenTask() )
        return;

    ActionListener al = Accessor.getDefaultAction( task );
    if( null != al ) {
        al.actionPerformed( e );
        return;
    }

    URL url = Accessor.getURL( task );
    if( null != url ) {
        URLDisplayer.getDefault().showURL(url);
        return;
    }
    int line = Accessor.getLine( task )-1;
    FileObject fileObject = Accessor.getFile(task);
    if( null == fileObject )
        return;
    /* Find a DataObject for the FileObject: */
    final DataObject dataObject;
    try {
        dataObject = DataObject.find(fileObject);
    } catch( DataObjectNotFoundException donfE ) {
        return;
    }

    LineCookie lineCookie = (LineCookie)dataObject.getCookie( LineCookie.class );
    if( null != lineCookie && openAt( lineCookie, line ) ) {
        return;
    }

    EditCookie editCookie = (EditCookie)dataObject.getCookie( EditCookie.class );
    if( null != editCookie ) {
        editCookie.edit();
        return;
    }

    OpenCookie openCookie = (OpenCookie)dataObject.getCookie( OpenCookie.class );
    if( null != openCookie ) {
        openCookie.open();
        return;
    }

    ViewCookie viewCookie = (ViewCookie)dataObject.getCookie( ViewCookie.class );
    if( null != viewCookie ) {
        viewCookie.view();
        return;
    }
}
 
源代码20 项目: netbeans   文件: JTitledPanel.java
private void fireActionPerformed() {
    for (ActionListener l : actionListeners) {
        l.actionPerformed(new ActionEvent(this, getState(), ""));
    }
}
 
 同类方法