001package jmri.jmrit.operations.locations; 002 003import java.awt.Frame; 004import java.awt.event.ActionEvent; 005 006import javax.swing.AbstractAction; 007 008/** 009 * Swing action open the yardmaster by track frame. 010 * 011 * @author Daniel Boudreau Copyright (C) 2015 012 * 013 */ 014public class YardmasterByTrackAction extends AbstractAction { 015 016 public YardmasterByTrackAction(Location location) { 017 super(Bundle.getMessage("TitleYardmasterByTrack")); 018 _location = location; 019 } 020 021 Location _location; 022 YardmasterByTrackFrame f = null; 023 024 @Override 025 public void actionPerformed(ActionEvent e) { 026 // create a frame 027 if (f == null || !f.isVisible()) { 028 f = new YardmasterByTrackFrame(_location); 029 } 030 f.setExtendedState(Frame.NORMAL); 031 f.setVisible(true); // this also brings the frame into focus 032 } 033} 034 035