001package jmri.jmrix.tmcc.serialmon;
002
003import java.awt.event.ActionEvent;
004import javax.swing.AbstractAction;
005import jmri.jmrix.tmcc.TmccSystemConnectionMemo;
006import org.slf4j.Logger;
007import org.slf4j.LoggerFactory;
008
009/**
010 * Swing action to create and register a SerialMonFrame object.
011 *
012 * @author Bob Jacobsen Copyright (C) 2001, 2006
013 */
014public class SerialMonAction extends AbstractAction {
015
016    private TmccSystemConnectionMemo _memo = null;
017
018    public SerialMonAction(String s, TmccSystemConnectionMemo memo) {
019        super(s);
020        _memo = memo;
021    }
022
023    public SerialMonAction() {
024        this(Bundle.getMessage("MonitorXTitle", "TMCC"), jmri.InstanceManager.getDefault(jmri.jmrix.tmcc.TmccSystemConnectionMemo.class));
025    }
026
027    @Override
028    public void actionPerformed(ActionEvent e) {
029        // create a SerialMonFrame
030        SerialMonFrame f = new SerialMonFrame(_memo);
031        try {
032            f.initComponents();
033        } catch (Exception ex) {
034            log.warn("SerialMonAction starting SerialMonFrame: Exception: {}", ex.toString());
035        }
036        f.setVisible(true);
037    }
038
039    private final static Logger log = LoggerFactory.getLogger(SerialMonAction.class);
040
041}