001package jmri.jmrit.operations.locations.tools; 002 003import java.awt.Frame; 004import java.awt.event.ActionEvent; 005 006import javax.swing.AbstractAction; 007 008import jmri.jmrit.operations.locations.Location; 009 010/** 011 * Swing action to create and register a LocationsByCarTypeFrame object. 012 * 013 * @author Daniel Boudreau Copyright (C) 2009 014 * 015 */ 016public class ModifyLocationsCarLoadsAction extends AbstractAction { 017 018 public ModifyLocationsCarLoadsAction(Location location) { 019 super(Bundle.getMessage("TitleModifyLocationLoad")); 020 _location = location; 021 } 022 023 public ModifyLocationsCarLoadsAction() { 024 super(Bundle.getMessage("TitleModifyLocationsLoad")); 025 } 026 027 Location _location; 028 LocationsByCarLoadFrame f = null; 029 030 @Override 031 public void actionPerformed(ActionEvent e) { 032 // create a frame 033 if (f == null || !f.isVisible()) { 034 f = new LocationsByCarLoadFrame(); 035 f.initComponents(_location); 036 } 037 f.setExtendedState(Frame.NORMAL); 038 f.setVisible(true); // this also brings the frame into focus 039 } 040} 041 042