001package jmri.jmrix.sprog.update;
002
003import java.awt.event.ActionEvent;
004
005import jmri.jmrix.sprog.SprogSystemConnectionMemo;
006import jmri.util.swing.JmriJOptionPane;
007
008/**
009 * Swing action to create and register a SprogIIUpdateFrame object.
010 *
011 * @author Andrew crosland Copyright (C) 2004
012 */
013public class SprogIIUpdateAction extends SprogUpdateAction {
014
015    public SprogIIUpdateAction(String s,SprogSystemConnectionMemo memo) {
016        super(s,memo);
017    }
018
019    @Override
020    public void actionPerformed(ActionEvent e) {
021        Object[] options = {Bundle.getMessage("ButtonCancel"), Bundle.getMessage("ButtonContinue")};
022        if (1 == // array position 1 ButtonContinue
023            JmriJOptionPane.showOptionDialog(null,
024                Bundle.getMessage("SprogXUpdateDialogString"),
025                Bundle.getMessage("SprogXFirmwareUpdate"), JmriJOptionPane.DEFAULT_OPTION,
026                JmriJOptionPane.QUESTION_MESSAGE, null, options, options[0])) {
027            // create a SprogIIUpdateFrame
028            SprogIIUpdateFrame f = new SprogIIUpdateFrame(_memo);
029            try {
030                f.initComponents();
031            } catch (Exception ex) {
032                log.warn("SprogIIUpdateAction starting SprogIIUpdateFrame: Exception: {}", ex.toString());
033            }
034            f.setVisible(true);
035        }
036    }
037
038    private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(SprogIIUpdateAction.class);
039
040}