@@ -45,14 +45,15 @@ public abstract class AbstractTextMonitor extends AbstractMonitor {
4545 protected JButton clearButton ;
4646 protected JCheckBox autoscrollBox ;
4747 protected JCheckBox addTimeStampBox ;
48- protected JComboBox lineEndings ;
49- protected JComboBox serialRates ;
48+ protected JComboBox < String > lineEndings ;
49+ protected JComboBox < String > serialRates ;
5050
5151 public AbstractTextMonitor (Base base , BoardPort boardPort ) {
5252 super (boardPort );
5353 this .base = base ;
5454 }
5555
56+ @ Override
5657 protected void onCreateWindow (Container mainPane ) {
5758
5859 mainPane .setLayout (new BorderLayout ());
@@ -111,6 +112,7 @@ public void keyPressed(KeyEvent e) {
111112 textField = new JTextField (40 );
112113 // textField is selected every time the window is focused
113114 addWindowFocusListener (new WindowAdapter () {
115+ @ Override
114116 public void windowGainedFocus (WindowEvent e ) {
115117 textField .requestFocusInWindow ();
116118 }
@@ -139,22 +141,17 @@ public void windowGainedFocus(WindowEvent e) {
139141 minimumSize .setSize (minimumSize .getWidth () / 3 , minimumSize .getHeight ());
140142 noLineEndingAlert .setMinimumSize (minimumSize );
141143
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 ());
153148 });
149+ addTimeStampBox .addActionListener ((ActionEvent event ) ->
150+ PreferencesData .setBoolean ("serial.show_timestamp" , addTimeStampBox .isSelected ()));
154151
155152 lineEndings .setMaximumSize (lineEndings .getMinimumSize ());
156153
157- serialRates = new JComboBox ();
154+ serialRates = new JComboBox < String > ();
158155 for (String rate : serialRateStrings ) {
159156 serialRates .addItem (rate + " " + tr ("baud" ));
160157 }
@@ -177,6 +174,7 @@ public void actionPerformed(ActionEvent e) {
177174 mainPane .add (pane , BorderLayout .SOUTH );
178175 }
179176
177+ @ Override
180178 protected void onEnableWindow (boolean enable )
181179 {
182180 textArea .setEnabled (enable );
@@ -203,6 +201,7 @@ public void onSerialRateChange(ActionListener listener) {
203201 serialRates .addActionListener (listener );
204202 }
205203
204+ @ Override
206205 public void message (String msg ) {
207206 SwingUtilities .invokeLater (() -> updateTextArea (msg ));
208207 }
0 commit comments