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