Example usage for java.awt.event ActionListener actionPerformed

List of usage examples for java.awt.event ActionListener actionPerformed

Introduction

In this page you can find the example usage for java.awt.event ActionListener actionPerformed.

Prototype

public void actionPerformed(ActionEvent e);

Source Link

Document

Invoked when an action occurs.

Usage

From source file:daylightchart.gui.util.GuiAction.java

/**
 * {@inheritDoc}/*  www .j a v  a  2 s.  c om*/
 *
 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
 */
@Override
public void actionPerformed(final ActionEvent e) {
    try {
        final ActionListener[] actionListeners = listeners.getListeners(ActionListener.class);
        for (final ActionListener actionListener : actionListeners) {
            actionListener.actionPerformed(e);
        }
    } catch (final Exception ex) {
        LOGGER.log(Level.WARNING, "Cannot perform action - " + getValue(SHORT_DESCRIPTION), ex);
    }
}

From source file:org.nuclos.client.ui.OptionGroup.java

/**
 *
 * @param ev//from   w  w w  .  j a  va 2  s  . co m
 */
public void fireAction(ActionEvent ev) {
    for (Iterator<ActionListener> iter = lstListener.iterator(); iter.hasNext();) {
        final ActionListener al = iter.next();
        al.actionPerformed(ev);
    }
}

From source file:org.fhcrc.cpl.viewer.quant.gui.LogRatioHistMouseListener.java

/**
 * Transform the region into values in units of the chart X axis
 */// w w  w  .  j  a  va 2  s .c o m
protected void transformAndSaveSelectedRegion() {
    selectedRealXMinValue = (float) super.transformMouseXValue(selectedRegion.getX());
    selectedRealXMaxValue = (float) super.transformMouseXValue(
            selectedRegion.getX() + selectedRegion.getWidth());

    for (ActionListener listener : rangeUpdateListeners) {
        listener.actionPerformed(new ActionEvent(this, 0, selectedRealXMinValue + "," + selectedRealXMaxValue));
    }
}

From source file:net.pandoragames.far.ui.swing.component.MacOSXMenuAdapter.java

/**
 * Calls the ActionListener that was registered for the command sting of this
 * ActionEvent. The command string is derived from the method name of the callback method. 
 * @param event wrapping an original apple event
 *///from   ww w  .j a v  a  2 s  .c  om
private void fireOSXEvent(OSXActionEvent event) {
    List<ActionListener> listenerList = listenerMap.get(event.getActionCommand());
    if (listenerList == null) {
        // should never happen - but we only log a warning though
        logger.warn("No listener found for command " + event.getActionCommand().toUpperCase());
        return;
    }
    logger.debug("Calling " + listenerList.size() + " ActionListener for command " + event.getActionCommand());
    for (ActionListener listener : listenerList) {
        listener.actionPerformed(event);
    }
}

From source file:com.microsoft.alm.plugin.idea.common.ui.controls.HelpPanel.java

private void onPopupCommandEvent(final String command) {
    hideToolTip(true);/*from  www . j  av  a 2  s  . co m*/
    for (final ActionListener listener : listeners) {
        listener.actionPerformed(new ActionEvent(this, 0, command));
    }
}

From source file:org.fhcrc.cpl.viewer.quant.gui.LogRatioHistMouseListener.java

/**
 * When the mouse is let go, save the range and signal the range update listeners
 * @param e//from   www .  ja  va  2  s.c o  m
 */
public void mouseReleased(MouseEvent e) {
    try {
        if (this.selectedRegion != null)
            drawOrUndrawRegion();

        transformAndSaveSelectedRegion();
        selectedRealXMinValue = (float) super.transformMouseXValue(selectedRegion.getX());
        selectedRealXMaxValue = (float) super.transformMouseXValue(
                selectedRegion.getX() + selectedRegion.getWidth());

        drawOrUndrawRegion();

        this.selectedRegionStart = null;

        for (ActionListener listener : rangeUpdateListeners) {
            listener.actionPerformed(
                    new ActionEvent(this, 0, selectedRealXMinValue + "," + selectedRealXMaxValue));
        }
    } catch (Exception ee) {
    }
}

From source file:org.photovault.swingui.tag.TagEditor2.java

private void fireActionEvent(String command) {
    ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, command);
    for (ActionListener l : actionListeners) {
        l.actionPerformed(e);
    }/*from  w ww  . ja  v  a2 s . c o  m*/
}

From source file:org.kepler.gui.AnnotatedPTree.java

/**
 * notify all listeners of events/*  ww  w  . j  a  v  a  2 s  . c o  m*/
 */
private void notifyListeners(ActionEvent event) {
    for (int i = 0; i < listeners.size(); i++) {
        ActionListener listener = (ActionListener) listeners.elementAt(i);
        listener.actionPerformed(event);
    }
}

From source file:Data.c_PriceDB.java

public boolean loadPricesDB(ActionListener listener) {
    boolean success = true;
    try {//w  w w.  j a  v  a  2  s .  co m
        FileUtils.copyURLToFile(new URL("http://www.magictraders.com/pricelists/current-magic-excel.txt"),
                new File(PRICES_FILE));
        listener.actionPerformed(new ActionEvent(this, Action.ACTION_FILE_LOAD_DONE, ""));
        success = updatePrices(listener, PRICES_FILE);
    } catch (Exception ex) {
        for (StackTraceElement elem : ex.getStackTrace()) {
            System.err.print(elem.toString() + "\n");
        }
        success = false;
    }
    return success;
}

From source file:com.limegroup.gnutella.gui.GUIUtils.java

/**
 * Returns a <code>MouseListener</code> that changes the cursor and
 * notifies <code>actionListener</code> on click.
 *///from   w w  w .jav a2 s . c o  m
public static MouseListener getURLInputListener(final ActionListener actionListener) {
    return new MouseAdapter() {
        public void mouseEntered(MouseEvent e) {
            JComponent comp = (JComponent) e.getComponent();
            comp.getTopLevelAncestor().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        }

        public void mouseExited(MouseEvent e) {
            JComponent comp = (JComponent) e.getComponent();
            comp.getTopLevelAncestor().setCursor(Cursor.getDefaultCursor());
        }

        public void mouseClicked(MouseEvent e) {
            actionListener.actionPerformed(new ActionEvent(e.getComponent(), 0, null));
        }
    };
}