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 create and register a TrainsByCarTypeFrame object.
010 *
011 * @author Daniel Boudreau Copyright (C) 2009
012 */
013public class TrainsByCarTypeAction extends AbstractAction {
014
015    public TrainsByCarTypeAction() {
016        super(Bundle.getMessage("TitleModifyTrains"));
017    }
018
019    TrainsByCarTypeFrame f = null;
020
021    @Override
022    public void actionPerformed(ActionEvent e) {
023        // create a frame
024        if (f == null || !f.isVisible()) {
025            f = new TrainsByCarTypeFrame();
026            f.initComponents("");
027        }
028        f.setExtendedState(Frame.NORMAL);
029        f.setVisible(true); // this also brings the frame into focus
030    }
031}
032
033