001package jmri.jmrit.operations.trains;
002
003import java.awt.event.ActionEvent;
004
005import javax.swing.AbstractAction;
006
007/**
008 * Swing action to create and register a TrainEditBuildOptionFrame.
009 *
010 * @author Bob Jacobsen Copyright (C) 2001
011 * @author Daniel Boudreau Copyright (C) 2010
012 */
013public class TrainEditBuildOptionsAction extends AbstractAction {
014
015    public TrainEditBuildOptionsAction(TrainEditFrame frame) {
016        super(Bundle.getMessage("MenuItemBuildOptions"));
017        this.frame = frame;
018    }
019
020    TrainEditFrame frame; // the parent frame that is launching the TrainEditBuildOptionsFrame.
021
022    TrainEditBuildOptionsFrame f = null;
023
024    @Override
025    public void actionPerformed(ActionEvent e) {
026        // create a train edit option frame
027        if (f != null && f.isVisible()) {
028            f.dispose();
029        }
030        f = new TrainEditBuildOptionsFrame();
031        f.initComponents(frame);
032    }
033}
034
035