001package jmri.jmrit.sensorgroup; 002 003import java.awt.event.ActionEvent; 004import javax.swing.AbstractAction; 005 006/** 007 * Swing action to create and register a SensorGroupFrame object 008 * 009 * @author Bob Jacobsen Copyright (C) 2003, 2007 010 */ 011public class SensorGroupAction extends AbstractAction { 012 013 public SensorGroupAction(String s) { 014 super(s); 015 016 // disable ourself if there is no route manager object available 017 if (jmri.InstanceManager.getNullableDefault(jmri.RouteManager.class) == null) { 018 setEnabled(false); 019 } 020 } 021 022 public SensorGroupAction() { 023 this("Define Sensor Group..."); 024 } 025 026 @Override 027 public void actionPerformed(ActionEvent e) { 028 SensorGroupFrame f = new SensorGroupFrame(); 029 f.initComponents(); 030 f.setVisible(true); 031 } 032}