001package jmri.jmrit.operations.trains.gui; 002 003import java.awt.event.ActionEvent; 004 005import javax.swing.AbstractAction; 006 007import jmri.jmrit.operations.rollingstock.cars.gui.CarsTableFrame; 008 009/** 010 * Swing action to create a CarsTableFrame. 011 * 012 * @author Daniel Boudreau Copyright (C) 2026 013 */ 014public class ShowCarsByLocationAction extends AbstractAction { 015 016 public ShowCarsByLocationAction(TrainConductorPanel tcp) { 017 super(Bundle.getMessage("MenuItemShowCars")); 018 _tcp = tcp; 019 } 020 021 TrainConductorPanel _tcp; 022 boolean showAllCars = false; 023 String trackName = null; 024 CarsTableFrame _ctf; 025 026 @Override 027 public void actionPerformed(ActionEvent e) { 028 // create a car table frame 029 if (_ctf != null) { 030 _ctf.dispose(); 031 } 032 _ctf = new CarsTableFrame(showAllCars, _tcp.getLocationName(), trackName); 033 } 034}