001package jmri.jmrit.timetable.swing; 002 003import java.awt.event.ActionEvent; 004import jmri.util.swing.JmriAbstractAction; 005 006/** 007 * Swing action to create and register a TimeTableFrame 008 * 009 * @author Dave Sand Copyright (C) 2018 010 */ 011public class TimeTableAction extends JmriAbstractAction { 012 013 public TimeTableAction(String s) { 014 super(s); 015 } 016 017 public TimeTableAction() { 018 this("TimeTable"); // NOI18N 019 } 020 021 @Override 022 public void actionPerformed(ActionEvent e) { 023 if (jmri.InstanceManager.getNullableDefault(TimeTableFrame.class) != null) { 024 // Prevent duplicate copies 025 return; 026 } 027 TimeTableFrame f = new TimeTableFrame(""); 028 f.setVisible(true); 029 } 030 031 // never invoked, because we overrode actionPerformed above 032 @Override 033 public jmri.util.swing.JmriPanel makePanel() { 034 throw new IllegalArgumentException("Should not be invoked"); // NOI18N 035 } 036}