001package jmri.jmrit.throttle.buttons;
002
003import java.awt.event.ActionEvent;
004import javax.swing.JButton;
005import jmri.InstanceManager;
006import jmri.jmrit.catalog.NamedIcon;
007import jmri.jmrit.throttle.ThrottleFrameManager;
008
009/**
010 * 
011 * A button to send an estop to all JMRI UI managed throttles
012 * 
013 * <hr>
014 * This file is part of JMRI.
015 * <p>
016 * JMRI is free software; you can redistribute it and/or modify it under the
017 * terms of version 2 of the GNU General Public License as published by the Free
018 * Software Foundation. See the "COPYING" file for a copy of this license.
019 * <p>
020 * JMRI is distributed in the hope that it will be useful, but WITHOUT ANY
021 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
022 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
023 *
024 */
025
026public class StopAllButton extends JButton {
027
028    public StopAllButton() {
029        super();
030        initGUI();
031    }
032        
033    private void initGUI() {    
034        //    stop.setText(Bundle.getMessage("ThrottleToolBarStopAll"));
035        setIcon(new NamedIcon("resources/icons/throttles/estop.png", "resources/icons/throttles/estop.png"));
036        setToolTipText(Bundle.getMessage("ThrottleToolBarStopAllToolTip"));
037        setVerticalTextPosition(JButton.BOTTOM);
038        setHorizontalTextPosition(JButton.CENTER);
039        addActionListener((ActionEvent e) -> {
040            InstanceManager.getDefault(ThrottleFrameManager.class).emergencyStopAll();
041        });
042    }
043}