001package jmri.jmrix.lenz.swing.packetgen;
002
003import java.awt.event.ActionEvent;
004import jmri.jmrix.lenz.swing.AbstractXPressNetAction;
005import org.slf4j.Logger;
006import org.slf4j.LoggerFactory;
007
008/**
009 * Swing action to create and register an XpressNet PacketGenFrame
010 * object
011 *
012 * @author Bob Jacobsen Copyright (C) 2001, 2002
013 */
014public class PacketGenAction extends AbstractXPressNetAction {
015
016    public PacketGenAction(String s, jmri.jmrix.lenz.XNetSystemConnectionMemo memo) {
017        super(s,memo);
018    }
019
020    public PacketGenAction(jmri.jmrix.lenz.XNetSystemConnectionMemo memo) {
021        this(Bundle.getMessage("PacketGenFrameTitle"), memo);
022    }
023
024    @Override
025    public void actionPerformed(ActionEvent e) {
026        // create a PacketGenFrame
027        PacketGenFrame f = new PacketGenFrame();
028        try {
029            f.initComponents();
030        } catch (Exception ex) {
031            log.error("Exception: {}", ex.toString());
032        }
033        f.setVisible(true);
034
035        // connect to the TrafficController
036        f.connect(_memo.getXNetTrafficController());
037    }
038
039    private static final Logger log = LoggerFactory.getLogger(PacketGenAction.class);
040
041}