001package jmri.jmrit.signalling;
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 SignallingFrame object.
010 *
011 * @author Kevin Dickerson Copyright (C) 2011
012 */
013public class SignallingFrameAction extends AbstractAction {
014
015    /**
016     * Create an action with the supplied name.
017     *
018     * @param s The name of the resulting action
019     */
020    public SignallingFrameAction(String s) {
021        super(s);
022    }
023
024    /**
025     * Create an action with a preset name, localizable via the Bundle mechanism.
026     */
027    public SignallingFrameAction() {
028        super(Bundle.getMessage("SignallingPairs"));  // NOI18N
029    }
030
031    @Override
032    public void actionPerformed(ActionEvent e) {
033        SignallingFrame f = new SignallingFrame();
034        try {
035            f.initComponents();
036        } catch (Exception ex) {
037            log.error("Exception: ", ex);
038        }
039        f.setVisible(true);
040    }
041    private final static Logger log = LoggerFactory.getLogger(SignallingFrameAction.class);
042}