001package jmri.jmrix.loconet.swing.throttlemsg;
002
003import java.awt.FlowLayout;
004import java.awt.event.ActionEvent;
005import java.awt.event.ActionListener;
006import javax.swing.JButton;
007import javax.swing.JTextField;
008
009/**
010 * Panel for sending messages to throttles.
011 *
012 * @author Bob Jacobsen Copyright (C) 2008, 2010
013 */
014public class MessagePanel extends jmri.jmrix.loconet.swing.LnPanel {
015
016    // GUI member declarations
017    JButton button = new JButton(Bundle.getMessage("ButtonSend"));
018    JTextField text = new JTextField(10);
019
020    public MessagePanel() {
021        super();
022
023        // general GUI config
024        // install items in GUI
025        setLayout(new FlowLayout());
026        add(text);
027        add(button);
028        button.addActionListener(new ActionListener() {
029            @Override
030            public void actionPerformed(ActionEvent e) {
031                memo.getLnMessageManager().sendMessage(text.getText());
032            }
033        });
034    }
035
036    @Override
037    public String getHelpTarget() {
038        return "package.jmri.jmrix.loconet.swing.throttlemsg.MessageFrame"; // NOI18N
039    }
040
041    @Override
042    public String getTitle() {
043        return getTitle(Bundle.getMessage("MenuItemThrottleMessages"));
044    }
045
046}