001package apps.PanelPro;
002
003import apps.Apps;
004import java.awt.event.ActionEvent;
005import java.text.MessageFormat;
006import javax.swing.AbstractAction;
007import javax.swing.Action;
008import javax.swing.BoxLayout;
009import javax.swing.JButton;
010import javax.swing.JLabel;
011import javax.swing.JPanel;
012
013/**
014 * The JMRI main pane for creating control panels.
015 *
016 * <hr>
017 * This file is part of JMRI.
018 * <p>
019 * JMRI is free software; you can redistribute it and/or modify it under the
020 * terms of version 2 of the GNU General Public License as published by the Free
021 * Software Foundation. See the "COPYING" file for a copy of this license.
022 * <p>
023 * JMRI is distributed in the hope that it will be useful, but WITHOUT ANY
024 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
025 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
026 *
027 * @author Bob Jacobsen Copyright 2003, 2014
028 */
029public class PanelProPane extends apps.AppsLaunchPane {
030
031    PanelProPane() {
032        super();
033    }
034
035    /**
036     * Returns the ID for the window's help, which is application specific
037     */
038    @Override
039    protected String windowHelpID() {
040        return "package.apps.PanelPro.PanelPro";
041    }
042
043    @Override
044    protected String logo() {
045        return "resources/PanelPro.gif";
046    }
047
048    @Override
049    protected String line1() {
050        return MessageFormat.format(Bundle.getMessage("PanelProVersionCredit"),
051                new Object[]{jmri.Version.name()});
052    }
053
054    @Override
055    protected String line2() {
056        return "http://jmri.org/PanelPro ";
057    }
058
059    @Override
060    protected JPanel statusPanel() {
061        JPanel j = new JPanel();
062        j.setLayout(new BoxLayout(j, BoxLayout.Y_AXIS));
063        j.add(super.statusPanel());
064
065        // Buttons
066        Action quit = new AbstractAction(Bundle.getMessage("MenuItemQuit")) {
067            @Override
068            public void actionPerformed(ActionEvent e) {
069                Apps.handleQuit();
070            }
071        };
072
073        JPanel p3 = new JPanel();
074        p3.setLayout(new java.awt.FlowLayout());
075        JButton h1 = new JButton(Bundle.getMessage("ButtonHelp"));
076        jmri.util.HelpUtil.addHelpToComponent(h1, "html.apps.PanelPro.index");
077        h1.setAlignmentX(JLabel.CENTER_ALIGNMENT);
078        p3.add(h1);
079        JButton q1 = new JButton(Bundle.getMessage("ButtonQuit"));
080        q1.addActionListener(quit);
081        q1.setAlignmentX(JLabel.CENTER_ALIGNMENT);
082        p3.add(q1);
083        j.add(p3);
084
085        return j;
086    }
087
088}