001package jmri.jmrit.operations.locations.schedules.tools; 002 003import java.awt.Frame; 004import java.awt.event.ActionEvent; 005 006import javax.swing.AbstractAction; 007 008import jmri.jmrit.operations.locations.Track; 009import jmri.jmrit.operations.locations.schedules.Schedule; 010 011/** 012 * Swing action to create and register a ScheduleCopyFrame object. 013 * 014 * @author Bob Jacobsen Copyright (C) 2001 015 * @author Daniel Boudreau Copyright (C) 2015, 2025 016 */ 017public class ScheduleCopyAction extends AbstractAction { 018 019 public ScheduleCopyAction() { 020 super(Bundle.getMessage("MenuItemCopySchedule")); 021 } 022 023 Schedule _schedule = null; 024 Track _track = null; 025 026 public ScheduleCopyAction(Schedule schedule, Track track) { 027 this(); 028 _schedule = schedule; 029 _track = track; 030 } 031 032 ScheduleCopyFrame f = null; 033 034 @Override 035 public void actionPerformed(ActionEvent e) { 036 if (f == null || !f.isVisible()) { 037 f = new ScheduleCopyFrame(_schedule, _track); 038 } 039 f.setExtendedState(Frame.NORMAL); 040 f.setVisible(true); // this also brings the frame into focus 041 } 042} 043 044