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