Playing around with the Arduino, I started missing the option to automatically send a line feed (\n) from the terminal monitor.
Since the development environment is open source, I couldn't resist adding it in. For anyone who's interested as well, here's the patch.
The patch:
--- SerialMonitor.org.java 2010-01-19 12:16:49.906250000 +0100
+++ SerialMonitor.java 2010-01-19 16:22:58.015625000 +0100
@@ -32,6 +32,7 @@
private JTextArea textArea;
private JTextField textField;
private JButton sendButton;
+ private JCheckBox sendNewLine;
private JComboBox serialRates;
private JLabel statusLabel;
private int serialRate;
@@ -73,18 +74,26 @@
textField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
send(textField.getText());
+ if(sendNewLine.isSelected()) send("\n");
textField.setText("");
}});
+ pane.add(textField, BorderLayout.CENTER);
+
+ JPanel sendPane = new JPanel(new FlowLayout());
+
sendButton = new JButton("Send");
sendButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
send(textField.getText());
+ if(sendNewLine.isSelected()) send("\n");
textField.setText("");
}});
- pane.add(textField, BorderLayout.CENTER);
- pane.add(sendButton, BorderLayout.EAST);
+ sendNewLine = new JCheckBox("Newline");
+ sendPane.add(sendButton);
+ sendPane.add(sendNewLine);
+ pane.add(sendPane, BorderLayout.EAST);
getContentPane().add(pane, BorderLayout.NORTH);
As you can see I've added the checkbox in a new panel. This panel has a FlowLayout. It contains the Send button too and is located in the East border, where the Send button used to be, in the BorderLayout panel.