@@ -45,14 +45,15 @@ public abstract class AbstractTextMonitor extends AbstractMonitor {
45
45
protected JButton clearButton ;
46
46
protected JCheckBox autoscrollBox ;
47
47
protected JCheckBox addTimeStampBox ;
48
- protected JComboBox lineEndings ;
49
- protected JComboBox serialRates ;
48
+ protected JComboBox < String > lineEndings ;
49
+ protected JComboBox < String > serialRates ;
50
50
51
51
public AbstractTextMonitor (Base base , BoardPort boardPort ) {
52
52
super (boardPort );
53
53
this .base = base ;
54
54
}
55
55
56
+ @ Override
56
57
protected void onCreateWindow (Container mainPane ) {
57
58
58
59
mainPane .setLayout (new BorderLayout ());
@@ -111,6 +112,7 @@ public void keyPressed(KeyEvent e) {
111
112
textField = new JTextField (40 );
112
113
// textField is selected every time the window is focused
113
114
addWindowFocusListener (new WindowAdapter () {
115
+ @ Override
114
116
public void windowGainedFocus (WindowEvent e ) {
115
117
textField .requestFocusInWindow ();
116
118
}
@@ -139,22 +141,17 @@ public void windowGainedFocus(WindowEvent e) {
139
141
minimumSize .setSize (minimumSize .getWidth () / 3 , minimumSize .getHeight ());
140
142
noLineEndingAlert .setMinimumSize (minimumSize );
141
143
142
- lineEndings = new JComboBox (new String []{tr ("No line ending" ), tr ("Newline" ), tr ("Carriage return" ), tr ("Both NL & CR" )});
143
- lineEndings .addActionListener (new ActionListener () {
144
- public void actionPerformed (ActionEvent event ) {
145
- PreferencesData .setInteger ("serial.line_ending" , lineEndings .getSelectedIndex ());
146
- noLineEndingAlert .setForeground (pane .getBackground ());
147
- }
148
- });
149
- addTimeStampBox .addActionListener (new ActionListener () {
150
- public void actionPerformed (ActionEvent e ) {
151
- PreferencesData .setBoolean ("serial.show_timestamp" , addTimeStampBox .isSelected ());
152
- }
144
+ lineEndings = new JComboBox <String >(new String []{tr ("No line ending" ), tr ("Newline" ), tr ("Carriage return" ), tr ("Both NL & CR" )});
145
+ lineEndings .addActionListener ((ActionEvent event ) -> {
146
+ PreferencesData .setInteger ("serial.line_ending" , lineEndings .getSelectedIndex ());
147
+ noLineEndingAlert .setForeground (pane .getBackground ());
153
148
});
149
+ addTimeStampBox .addActionListener ((ActionEvent event ) ->
150
+ PreferencesData .setBoolean ("serial.show_timestamp" , addTimeStampBox .isSelected ()));
154
151
155
152
lineEndings .setMaximumSize (lineEndings .getMinimumSize ());
156
153
157
- serialRates = new JComboBox ();
154
+ serialRates = new JComboBox < String > ();
158
155
for (String rate : serialRateStrings ) {
159
156
serialRates .addItem (rate + " " + tr ("baud" ));
160
157
}
@@ -177,6 +174,7 @@ public void actionPerformed(ActionEvent e) {
177
174
mainPane .add (pane , BorderLayout .SOUTH );
178
175
}
179
176
177
+ @ Override
180
178
protected void onEnableWindow (boolean enable )
181
179
{
182
180
textArea .setEnabled (enable );
@@ -203,6 +201,7 @@ public void onSerialRateChange(ActionListener listener) {
203
201
serialRates .addActionListener (listener );
204
202
}
205
203
204
+ @ Override
206
205
public void message (String msg ) {
207
206
SwingUtilities .invokeLater (() -> updateTextArea (msg ));
208
207
}
0 commit comments