/*
 * @(#)AsyncActionListener.java  1.0  2000-10-09
 *
 * Copyright (c) 2000 Werner Randelshofer, Immensee, Switzerland.
 * All rights reserved.
 *
 * You may not use, copy or modify this file, except in compliance with the
 * license agreement you entered into with Werner Randelshofer.
 * For details see accompanying license terms.
 */
package ch.randelshofer.util;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.SwingUtilities;

/**
 * Invokes the actionPerformed event using SwingUtilities.invokeLater.
 * This class is useful for actions that must run in the event dispatcher
 * thread after the event source has finished some cleanup operations.
 *
 * @author  Werner Randelshofer, Hausmatt 10, CH-6405 Immensee, Switzerland
 * @version    1.0  2000-10-09
 */
public class AsyncActionListener
implements ActionListener {
    private ActionListener actionListener;
    public AsyncActionListener(ActionListener l) {
        this.actionListener = l;
    }

    public void actionPerformed(final ActionEvent event) {
        SwingUtilities.invokeLater(
            new Runnable() {
                public void run() {
                    actionListener.actionPerformed(event);
                }
            }
        );
    }
}
