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 TrainRoadOptionsFrame. 009 * 010 * @author Bob Jacobsen Copyright (C) 2001 011 * @author Daniel Boudreau Copyright (C) 2013 012 * 013 */ 014public class TrainRoadOptionsAction extends AbstractAction { 015 016 public TrainRoadOptionsAction(TrainEditFrame frame) { 017 super(Bundle.getMessage("MenuItemRoadOptions")); 018 _frame = frame; 019 } 020 021 TrainEditFrame _frame; // the parent frame that is launching the TrainEditBuildOptionsFrame. 022 023 TrainRoadOptionsFrame f = null; 024 025 @Override 026 public void actionPerformed(ActionEvent e) { 027 // create a train edit option frame 028 if (f != null && f.isVisible()) { 029 f.dispose(); 030 } 031 f = new TrainRoadOptionsFrame(); 032 f.initComponents(_frame); 033 } 034} 035 036