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