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