001package jmri.jmrix.pricom.pockettester; 002 003import java.awt.event.ActionEvent; 004import javax.swing.AbstractAction; 005import org.slf4j.Logger; 006import org.slf4j.LoggerFactory; 007 008/** 009 * Swing action to create and register a pricom.pockettester.MonitorAction 010 * object 011 * 012 * @see jmri.jmrix.pricom.pockettester.MonitorFrame 013 * 014 * @author Bob Jacobsen Copyright (C) 2002,2004 015 */ 016public abstract class MonitorAction extends AbstractAction { 017 018 public MonitorAction(String s) { 019 super(s); 020 } 021 022 public MonitorAction() { 023 putValue(javax.swing.Action.NAME, Bundle.getMessage("ActionMonitor")); 024 } 025 026 @Override 027 public void actionPerformed(ActionEvent e) { 028 MonitorFrame f = new MonitorFrame(); 029 try { 030 f.initComponents(); 031 } catch (Exception ex) { 032 log.error("starting MonitorFrame caught exception: {}", ex.toString()); 033 } 034 connect(f); 035 f.setVisible(true); 036 } 037 038 abstract void connect(DataListener l); 039 040 private final static Logger log = LoggerFactory.getLogger(MonitorAction.class); 041 042}