List of usage examples for java.awt.event ActionListener actionPerformed
public void actionPerformed(ActionEvent e);
From source file:net.technicpack.launcher.ui.components.discover.DiscoverInfoPanel.java
protected void triggerLoadListener() { final ActionListener deferredListener = loadListener; if (deferredListener != null) { EventQueue.invokeLater(new Runnable() { @Override//from ww w . ja va 2 s . co m public void run() { deferredListener.actionPerformed(new ActionEvent(this, 0, "loaded")); } }); loadListener = null; } }
From source file:inflor.core.plots.FCSChartPanel.java
public void activateGateSelectButton() { ActionListener[] action = selectionButton.getActionListeners(); for (ActionListener act : action) { if (act instanceof SelectionButtonListener) { ActionEvent event = new ActionEvent(selectionButton, 42, "What was the question again?"); act.actionPerformed(event); }/*from w ww . j ava 2s .c o m*/ } }
From source file:net.sf.nmedit.nomad.core.menulayout.MLEntry.java
/** * notifies all listeners/*from w ww . j a v a2s. c o m*/ */ public void actionPerformed(ActionEvent e) { if (listenerList != null) { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == ActionListener.class) { ActionListener al = (ActionListener) listeners[i + 1]; if (al != this) // for savety { al.actionPerformed(e); } } } } }
From source file:org.jdal.swing.Selector.java
/** * Notify listeners that selected values changes *///from w w w .j a v a 2 s. c o m protected void fireActionEvent() { if (!firingActionEvent) { firingActionEvent = true; ActionEvent event = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "selectorChanged"); for (ActionListener listener : listenerList.getListeners(ActionListener.class)) listener.actionPerformed(event); firingActionEvent = false; } }
From source file:net.sf.jabref.gui.fieldeditors.FileListEditor.java
/** * Run a file download operation./* w w w . ja v a 2s .c om*/ */ private void downloadFile() { String bibtexKey = entryEditor.getEntry().getCiteKey(); if (bibtexKey == null) { int answer = JOptionPane.showConfirmDialog(frame, Localization.lang("This entry has no BibTeX key. Generate key now?"), Localization.lang("Download file"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (answer == JOptionPane.OK_OPTION) { ActionListener l = entryEditor.getGenerateKeyAction(); l.actionPerformed(null); bibtexKey = entryEditor.getEntry().getCiteKey(); } } DownloadExternalFile def = new DownloadExternalFile(frame, frame.getCurrentBasePanel().getBibDatabaseContext(), bibtexKey); try { def.download(this); } catch (IOException ex) { LOGGER.warn("Cannot download.", ex); } }
From source file:ffx.ui.MainMenu.java
private Action addMenuItem(JMenu menu, String icon, String actionCommand, int mnemonic, int accelerator, final ActionListener actionListener) { Action a = new AbstractAction() { @Override/*from w w w . j ava2 s. c o m*/ public void actionPerformed(ActionEvent e) { actionListener.actionPerformed(e); } }; configureAction(a, icon, actionCommand, mnemonic, accelerator); JMenuItem menuItem = new JMenuItem(a); menu.add(menuItem); return a; }
From source file:com.diversityarrays.kdxplore.trials.TrialOverviewPanel.java
protected void fireEditCommand(MouseEvent e) { ActionEvent event = new ActionEvent(this, ++EVENT_COUNT, EDIT_TRIAL_COMMAND); for (ActionListener l : listenerList.getListeners(ActionListener.class)) { l.actionPerformed(event); }//from www.j a v a 2 s .co m }
From source file:forge.screens.deckeditor.DeckImport.java
/** * Instantiates a new deck import./*from ww w . j a va2s . com*/ * * @param g * the g */ public DeckImport(final ACEditorBase<TItem, TModel> g) { this.host = g; final int wWidth = 700; final int wHeight = 600; this.setPreferredSize(new java.awt.Dimension(wWidth, wHeight)); this.setSize(wWidth, wHeight); this.setTitle("Deck Importer"); txtInput.setFocusable(true); txtInput.setEditable(true); FSkin.SkinColor foreColor = FSkin.getColor(FSkin.Colors.CLR_TEXT); this.scrollInput.setBorder(new FSkin.TitledSkinBorder(BorderFactory.createEtchedBorder(), "Paste or type a decklist", foreColor)); this.scrollOutput.setBorder(new FSkin.TitledSkinBorder(BorderFactory.createEtchedBorder(), "Expect the recognized lines to appear", foreColor)); this.scrollInput.setViewportBorder(BorderFactory.createLoweredBevelBorder()); this.scrollOutput.setViewportBorder(BorderFactory.createLoweredBevelBorder()); this.add(this.scrollInput, "cell 0 0, w 50%, growy, pushy"); this.add(this.newEditionCheck, "cell 0 1, w 50%, ax c"); this.add(this.dateTimeCheck, "cell 0 2, w 50%, ax c"); this.add(monthDropdown, "cell 0 3, w 20%, ax left, split 2, pad 0 4 0 0"); this.add(yearDropdown, "w 15%"); fillDateDropdowns(); this.add(this.onlyCoreExpCheck, "cell 0 4, w 50%, ax c"); this.add(this.scrollOutput, "cell 1 0, w 50%, growy, pushy"); this.add(this.summaryMain, "cell 1 1, label"); this.add(this.summarySide, "cell 1 2, label"); this.add(this.cmdAccept, "cell 1 4, split 2, w 150, align r, h 26"); this.add(this.cmdCancel, "w 150, h 26"); this.cmdCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { DeckImport.this.processWindowEvent(new WindowEvent(DeckImport.this, WindowEvent.WINDOW_CLOSING)); } }); this.cmdAccept.addActionListener(new ActionListener() { @SuppressWarnings("unchecked") @Override public void actionPerformed(final ActionEvent e) { final String warning = "This will replace contents of your currently open deck with whatever you are importing. Proceed?"; if (!FOptionPane.showConfirmDialog(warning, "Replacing old deck")) { return; } final Deck toSet = DeckImport.this.buildDeck(); DeckImport.this.host.getDeckController().setModel((TModel) toSet); DeckImport.this.processWindowEvent(new WindowEvent(DeckImport.this, WindowEvent.WINDOW_CLOSING)); } }); ActionListener updateDateCheck = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean isSel = dateTimeCheck.isSelected(); monthDropdown.setEnabled(isSel); yearDropdown.setEnabled(isSel); parseAndDisplay(); } }; this.dateTimeCheck.addActionListener(updateDateCheck); ActionListener reparse = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { parseAndDisplay(); } }; this.newEditionCheck.addActionListener(reparse); this.onlyCoreExpCheck.addActionListener(reparse); this.yearDropdown.addActionListener(reparse); this.monthDropdown.addActionListener(reparse); updateDateCheck.actionPerformed(null); // update actual state this.txtInput.getDocument().addDocumentListener(new OnChangeTextUpdate()); this.cmdAccept.setEnabled(false); }
From source file:ffx.ui.MainMenu.java
private JCheckBoxMenuItem addCBMenuItem(JMenu menu, String icon, String actionCommand, int mnemonic, int accelerator, final ActionListener actionListener) { final JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(); Action a = new AbstractAction() { @Override//from w w w. j a v a 2 s. com public void actionPerformed(ActionEvent e) { /** * If the ActionEvent is from a ToolBar button, pass it through * the JCheckBoxMenuItem. */ if (e.getSource() != menuItem) { menuItem.doClick(); return; } actionListener.actionPerformed(e); } }; configureAction(a, icon, actionCommand, mnemonic, accelerator); menuItem.setAction(a); menu.add(menuItem); return menuItem; }
From source file:ffx.ui.MainMenu.java
private JRadioButtonMenuItem addBGMI(ButtonGroup buttonGroup, JMenu menu, String icon, String actionCommand, int mnemonic, int accelerator, final ActionListener actionListener) { final JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(); Action a = new AbstractAction() { @Override/*w w w. ja v a 2 s. c o m*/ public void actionPerformed(ActionEvent e) { /** * If the ActionEvent is from a ToolBar button, pass it through * the JRadioButtonMenuItem. */ if (e.getSource() != menuItem) { menuItem.doClick(); return; } actionListener.actionPerformed(e); } }; this.configureAction(a, icon, actionCommand, mnemonic, accelerator); menuItem.setAction(a); buttonGroup.add(menuItem); menu.add(menuItem); return menuItem; }