001package jmri.jmrit.roster.swing.speedprofile; 002 003import java.awt.BorderLayout; 004 005import jmri.util.swing.JmriJOptionPane; 006 007/** 008 * Frame Entry Exit Frames 009 * 010 * @author Kevin Dickerson Copyright (C) 2011 011 */ 012public class SpeedProfileFrame extends jmri.util.JmriJFrame { 013 014 public SpeedProfileFrame() { 015 super(false, true); 016 spPanel = new SpeedProfilePanel(); 017 } 018 019 SpeedProfilePanel spPanel; 020 021 @Override 022 public void initComponents() { 023 // the following code sets the frame's initial state 024 025 setTitle(Bundle.getMessage("SpeedProfile")); 026 getContentPane().setLayout(new BorderLayout(15,15)); 027 028 getContentPane().add(spPanel); 029 030 addHelpMenu("package.jmri.jmrit.roster.swing.speedprofile.SpeedProfileFrame", true); 031 032 addWindowListener(new java.awt.event.WindowAdapter() { 033 @Override 034 public void windowClosing(java.awt.event.WindowEvent e) { 035 windowClosingEvent(); 036 } 037 }); 038 // pack for display 039 pack(); 040 } 041 042 public void windowClosingEvent() { 043 spPanel.cancelButton(); 044 if (spPanel.save) { 045 if (JmriJOptionPane.showConfirmDialog(this, Bundle.getMessage("SaveProfile"), 046 Bundle.getMessage("SpeedProfile"), JmriJOptionPane.YES_NO_OPTION, 047 JmriJOptionPane.QUESTION_MESSAGE) == JmriJOptionPane.YES_OPTION) { 048 spPanel.updateSpeedProfileWithResults(); 049 } 050 } 051 if (spPanel.table !=null) { 052 spPanel.table.dispose(); 053 } 054 } 055 056}