001package jmri.jmrix.acela.packetgen; 002 003import java.awt.event.ActionEvent; 004import javax.swing.AbstractAction; 005import jmri.jmrix.acela.AcelaSystemConnectionMemo; 006import org.slf4j.Logger; 007import org.slf4j.LoggerFactory; 008 009/** 010 * Swing action to create and register an AcelaPacketGenFrame object 011 * 012 * @author Bob Jacobsen Copyright (C) 2001 013 * 014 * @author Bob Coleman, Copyright (C) 2007, 2008 Based on CMRI serial example, 015 * modified to establish Acela support. 016 */ 017public class AcelaPacketGenAction extends AbstractAction { 018 019 private AcelaSystemConnectionMemo _memo = null; 020 021 public AcelaPacketGenAction(String s, AcelaSystemConnectionMemo memo) { 022 super(s); 023 _memo = memo; 024 } 025 026 public AcelaPacketGenAction() { 027 this(Bundle.getMessage("AcelaSendCommandTitle"), 028 jmri.InstanceManager.getDefault(jmri.jmrix.acela.AcelaSystemConnectionMemo.class)); 029 } 030 031 @Override 032 public void actionPerformed(ActionEvent e) { 033 AcelaPacketGenFrame f = new AcelaPacketGenFrame(_memo); 034 try { 035 f.initComponents(); 036 } catch (Exception ex) { 037 log.error("Exception: {}", ex.toString()); 038 } 039 f.setVisible(true); 040 } 041 042 private final static Logger log = LoggerFactory.getLogger(AcelaPacketGenAction.class); 043 044}