001package jmri.jmrit.vsdecoder;
002
003import java.awt.event.ActionEvent;
004import javax.swing.AbstractAction;
005import javax.swing.JFrame;
006
007/**
008 * Start Virtual Sound Decoder Manager.
009 *
010 * <hr>
011 * This file is part of JMRI.
012 * <p>
013 * JMRI is free software; you can redistribute it and/or modify it under
014 * the terms of version 2 of the GNU General Public License as published
015 * by the Free Software Foundation. See the "COPYING" file for a copy
016 * of this license.
017 * <p>
018 * JMRI is distributed in the hope that it will be useful, but WITHOUT
019 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
020 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
021 * for more details.
022 *
023 * @author Mark Underwood Copyright (C) 2011
024 */
025public class VSDecoderCreationAction extends AbstractAction {
026
027    /**
028     * Constructor
029     *
030     * @param s Name for the action.
031     */
032    public VSDecoderCreationAction(String s) {
033        super(s);
034    }
035
036    public VSDecoderCreationAction() {
037        this("Virtual Sound Decoder");
038    }
039
040    /**
041     * The action is performed. Create a new ThrottleFrame.
042     *
043     * @param e The event causing the action.
044     */
045    @Override
046    public void actionPerformed(ActionEvent e) {
047        JFrame tf;
048
049        tf = VSDecoderManager.instance().provideManagerFrame(); // headless will return null
050
051        if (tf != null) {
052            tf.toFront();
053        }
054    }
055
056}