001package jmri.jmrit.operations.locations.tools;
002
003import java.awt.Frame;
004import java.awt.event.ActionEvent;
005import javax.swing.AbstractAction;
006
007/**
008 * Swing action to create and register a LocationCopyFrame object.
009 *
010 * @author Bob Jacobsen Copyright (C) 2001
011 * @author Daniel Boudreau Copyright (C) 2014
012 */
013public class LocationCopyAction extends AbstractAction {
014
015    public LocationCopyAction() {
016        super(Bundle.getMessage("MenuItemCopyLocation"));
017    }
018
019    LocationCopyFrame 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 LocationCopyFrame();
026        }
027        f.setExtendedState(Frame.NORMAL);
028        f.setVisible(true); // this also brings the frame into focus
029    }
030}
031
032