Java Code Examples for java.awt.event.ActionListener#actionPerformed()
The following examples show how to use
java.awt.event.ActionListener#actionPerformed() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: netbeans File: CustomizerProviderImpl.java License: Apache License 2.0 | 7 votes |
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(); } }
Example 2
Source Project: netbeans File: PerformanceTestCase.java License: Apache License 2.0 | 6 votes |
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() ); }
Example 3
Source Project: netbeans File: CustomizerProviderImpl.java License: Apache License 2.0 | 6 votes |
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(); } }
Example 4
Source Project: netbeans File: WeakTimerListener.java License: Apache License 2.0 | 6 votes |
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(); } } } }
Example 5
Source Project: netbeans File: ActionMapAction.java License: Apache License 2.0 | 6 votes |
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; }
Example 6
Source Project: netbeans File: OLCustomizer.java License: Apache License 2.0 | 6 votes |
@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())); } } } } }
Example 7
Source Project: netbeans File: CustomizerProviderImpl.java License: Apache License 2.0 | 6 votes |
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(); } }
Example 8
Source Project: PacketProxy File: FilterComboBoxEditor.java License: Apache License 2.0 | 5 votes |
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); } } }
Example 9
Source Project: FlatLaf File: FlatComboBoxUI.java License: Apache License 2.0 | 5 votes |
@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() ) ); } }
Example 10
Source Project: ghidra File: DiffApplySettingsProvider.java License: Apache License 2.0 | 5 votes |
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)); } }
Example 11
Source Project: netbeans File: SelectionList.java License: Apache License 2.0 | 5 votes |
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 } } } }
Example 12
Source Project: netbeans File: ResolveBrokenRuntimePlatform.java License: Apache License 2.0 | 5 votes |
/** * 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); } }
Example 13
Source Project: netbeans File: LinkButtonPanel.java License: Apache License 2.0 | 5 votes |
/** * 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); } } } }; }
Example 14
Source Project: Logisim File: MenuItemHelper.java License: GNU General Public License v3.0 | 5 votes |
@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); } } }
Example 15
Source Project: netbeans File: NBTabbedPane.java License: Apache License 2.0 | 5 votes |
/** * 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 ); } }
Example 16
Source Project: shogun File: TaskTrayTest.java License: Apache License 2.0 | 4 votes |
void click() { for (ActionListener actionListener : menu.getActionListeners()) { actionListener.actionPerformed(new ActionEvent(TaskTrayTest.class, 0, "dummy")); } }
Example 17
Source Project: netbeans File: SortAttributePanel.java License: Apache License 2.0 | 4 votes |
private void fireEvent(ActionEvent e) { for (ActionListener listener : changeListeners) { listener.actionPerformed(e); } }
Example 18
Source Project: netbeans File: NbPresenter.java License: Apache License 2.0 | 4 votes |
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(); } } }
Example 19
Source Project: netbeans File: OpenTaskAction.java License: Apache License 2.0 | 4 votes |
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; } }
Example 20
Source Project: netbeans File: JTitledPanel.java License: Apache License 2.0 | 4 votes |
private void fireActionPerformed() { for (ActionListener l : actionListeners) { l.actionPerformed(new ActionEvent(this, getState(), "")); } }