001package jmri.jmrit.simplelightctrl;
002
003import java.awt.event.ActionEvent;
004import javax.swing.AbstractAction;
005
006/**
007 * Swing action to create and register a SimpleTurnoutCtrlFrame
008 * object.
009 *
010 * @author Bob Jacobsen Copyright (C) 2001
011 */
012public class SimpleLightCtrlAction extends AbstractAction {
013
014    public SimpleLightCtrlAction(String s) {
015        super(s);
016
017        // disable ourself if there is no primary light manager available
018        if (jmri.InstanceManager.getNullableDefault(jmri.LightManager.class) == null) {
019            setEnabled(false);
020        }
021    }
022
023    public SimpleLightCtrlAction() {
024        this(Bundle.getMessage("Lights"));
025    }
026
027    @Override
028    public void actionPerformed(ActionEvent e) {
029
030        SimpleLightCtrlFrame f = new SimpleLightCtrlFrame();
031        f.setVisible(true);
032    }
033
034}