001package jmri.jmrix.oaktree.packetgen; 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 SerialPacketGenFrame 011 * object. 012 * 013 * @author Bob Jacobsen Copyright (C) 2001 014 */ 015public class SerialPacketGenAction extends AbstractAction { 016 017 private OakTreeSystemConnectionMemo _memo = null; 018 019 public SerialPacketGenAction(String s, OakTreeSystemConnectionMemo memo) { 020 super(s); 021 _memo = memo; 022 } 023 024 public SerialPacketGenAction(OakTreeSystemConnectionMemo memo) { 025 this(Bundle.getMessage("SendXCommandTitle", Bundle.getMessage("MenuOakTree")), memo); 026 } 027 028 @Override 029 public void actionPerformed(ActionEvent e) { 030 SerialPacketGenFrame f = new SerialPacketGenFrame(_memo); 031 try { 032 f.initComponents(); 033 } catch (Exception ex) { 034 log.error("Exception: {}", ex.toString()); 035 } 036 f.setVisible(true); 037 } 038 039 private final static Logger log = LoggerFactory.getLogger(SerialPacketGenAction.class); 040 041}