16
16
17
17
public abstract class AbstractMonitor extends JFrame implements MessageConsumer {
18
18
19
+ protected final JLabel noLineEndingAlert ;
19
20
protected JTextArea textArea ;
20
21
protected JScrollPane scrollPane ;
21
22
protected JTextField textField ;
@@ -69,29 +70,33 @@ public void actionPerformed(ActionEvent event) {
69
70
70
71
getContentPane ().add (scrollPane , BorderLayout .CENTER );
71
72
72
- JPanel pane = new JPanel ();
73
- pane .setLayout (new BoxLayout (pane , BoxLayout .X_AXIS ));
74
- pane .setBorder (new EmptyBorder (4 , 4 , 4 , 4 ));
73
+ JPanel upperPane = new JPanel ();
74
+ upperPane .setLayout (new BoxLayout (upperPane , BoxLayout .X_AXIS ));
75
+ upperPane .setBorder (new EmptyBorder (4 , 4 , 4 , 4 ));
75
76
76
77
textField = new JTextField (40 );
77
78
sendButton = new JButton (_ ("Send" ));
78
79
79
- pane .add (textField );
80
- pane .add (Box .createRigidArea (new Dimension (4 , 0 )));
81
- pane .add (sendButton );
80
+ upperPane .add (textField );
81
+ upperPane .add (Box .createRigidArea (new Dimension (4 , 0 )));
82
+ upperPane .add (sendButton );
82
83
83
- getContentPane ().add (pane , BorderLayout .NORTH );
84
+ getContentPane ().add (upperPane , BorderLayout .NORTH );
84
85
85
- pane = new JPanel ();
86
+ final JPanel pane = new JPanel ();
86
87
pane .setLayout (new BoxLayout (pane , BoxLayout .X_AXIS ));
87
88
pane .setBorder (new EmptyBorder (4 , 4 , 4 , 4 ));
88
89
89
90
autoscrollBox = new JCheckBox (_ ("Autoscroll" ), true );
90
91
92
+ noLineEndingAlert = new JLabel (I18n .format (_ ("You've pressed {0} but nothing was sent. Should you select a line ending?" ), _ ("Send" )));
93
+ noLineEndingAlert .setForeground (pane .getBackground ());
94
+
91
95
lineEndings = new JComboBox (new String []{_ ("No line ending" ), _ ("Newline" ), _ ("Carriage return" ), _ ("Both NL & CR" )});
92
96
lineEndings .addActionListener (new ActionListener () {
93
97
public void actionPerformed (ActionEvent event ) {
94
98
Preferences .setInteger ("serial.line_ending" , lineEndings .getSelectedIndex ());
99
+ noLineEndingAlert .setForeground (pane .getBackground ());
95
100
}
96
101
});
97
102
if (Preferences .get ("serial.line_ending" ) != null ) {
@@ -113,6 +118,8 @@ public void actionPerformed(ActionEvent event) {
113
118
114
119
pane .add (autoscrollBox );
115
120
pane .add (Box .createHorizontalGlue ());
121
+ pane .add (noLineEndingAlert );
122
+ pane .add (Box .createRigidArea (new Dimension (8 , 0 )));
116
123
pane .add (lineEndings );
117
124
pane .add (Box .createRigidArea (new Dimension (8 , 0 )));
118
125
pane .add (serialRates );
0 commit comments