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