001package jmri.jmrix.sprog.console;
002
003import java.awt.event.ActionEvent;
004import javax.swing.AbstractAction;
005import jmri.jmrix.sprog.SprogSystemConnectionMemo;
006import org.slf4j.Logger;
007import org.slf4j.LoggerFactory;
008
009/**
010 * Swing action to create and register a SprogConsoleFrame object.
011 *
012 * @author Andrew Crosland Copyright (C) 2008
013 */
014public class SprogConsoleAction extends AbstractAction {
015
016    private SprogSystemConnectionMemo _memo;
017
018    public SprogConsoleAction(String s, SprogSystemConnectionMemo memo) {
019        super(s);
020        _memo = memo;
021    }
022
023    @Override
024    public void actionPerformed(ActionEvent e) {
025        SprogConsoleFrame f = new SprogConsoleFrame(_memo);
026        try {
027            f.initComponents();
028        } catch (Exception ex) {
029            log.error("Exception: {}", ex.toString());
030        }
031        f.setVisible(true);
032    }
033
034    private final static Logger log = LoggerFactory.getLogger(SprogConsoleAction.class);
035
036}