001package jmri.jmrit.operations.trains.schedules;
002
003import java.awt.Frame;
004import java.awt.event.ActionEvent;
005
006import javax.swing.AbstractAction;
007
008/**
009 * Swing action to create and register a TrainsScheduleTableFrame object.
010 *
011 * @author Daniel Boudreau Copyright (C) 2010
012 */
013public class TrainsScheduleAction extends AbstractAction {
014    
015    public TrainsScheduleAction() {
016        super(Bundle.getMessage("TitleScheduleTrains"));
017    }
018
019    TrainsScheduleTableFrame f = null;
020
021    @Override
022    public void actionPerformed(ActionEvent e) {
023        // create a frame
024        if (f == null || !f.isVisible()) {
025            f = new TrainsScheduleTableFrame();
026        }
027        f.setExtendedState(Frame.NORMAL);
028        f.setVisible(true); // this also brings the frame into focus
029    }
030}
031
032