001package jmri.jmrit.operations.trains.tools;
002
003import java.awt.Frame;
004import java.awt.event.ActionEvent;
005
006import javax.swing.AbstractAction;
007
008/**
009 * Swing action to launch the Change Departure Time window.
010 *
011 * @author Bob Jacobsen Copyright (C) 2001
012 * @author Daniel Boudreau Copyright (C) 2013
013 */
014public class ChangeDepartureTimesAction extends AbstractAction {
015
016    public ChangeDepartureTimesAction() {
017        super(Bundle.getMessage("TitleChangeDepartureTime"));
018    }
019
020    ChangeDepartureTimesFrame f = null;
021
022    @Override
023    public void actionPerformed(ActionEvent e) {
024        // create a copy train frame
025        if (f == null || !f.isVisible()) {
026            f = new ChangeDepartureTimesFrame();
027        }
028        f.setExtendedState(Frame.NORMAL);
029        f.setVisible(true); // this also brings the frame into focus
030    }
031}
032
033