001package jmri.jmrit.vsdecoder.swing;
002
003import java.awt.event.ActionEvent;
004import javax.swing.AbstractAction;
005import javax.swing.JFrame;
006import jmri.jmrit.vsdecoder.VSDecoderManager;
007import jmri.util.JmriJFrame;
008
009/**
010 * VSD Preferences Action.
011 *
012 * <hr>
013 * This file is part of JMRI.
014 * <p>
015 * JMRI is free software; you can redistribute it and/or modify it under
016 * the terms of version 2 of the GNU General Public License as published
017 * by the Free Software Foundation. See the "COPYING" file for a copy
018 * of this license.
019 * <p>
020 * JMRI is distributed in the hope that it will be useful, but WITHOUT
021 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
022 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
023 * for more details.
024 *
025 * @author Mark Underwood Copyright (C) 2011
026 */
027public class VSDPreferencesAction extends AbstractAction {
028
029    /**
030     * Constructor
031     *
032     * @param s Name for the action.
033     */
034    public VSDPreferencesAction(String s) {
035        super(s);
036    }
037
038    public VSDPreferencesAction() {
039        this("VSDecoder preferences");
040    }
041
042    @Override
043    public void actionPerformed(ActionEvent e) {
044        JmriJFrame f = new JmriJFrame(Bundle.getMessage("VSDecoderFileMenuPreferences"), true, true); // used here for the Frame Title
045        VSDecoderPreferencesPane tpP = new VSDecoderPreferencesPane(VSDecoderManager.instance().getVSDecoderPreferences());
046        f.add(tpP);
047        tpP.setContainer(f);
048        f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
049        f.pack();
050        f.setVisible(true);
051        f.requestFocus();
052    }
053}