Skip to content

Commit a5e866f

Browse files
committed
makeup: using some lambdas where possible
1 parent 8f5f4f5 commit a5e866f

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

app/src/cc/arduino/contributions/ui/FilterJTextField.java

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
import javax.swing.event.DocumentEvent;
3434
import javax.swing.event.DocumentListener;
3535
import java.awt.*;
36-
import java.awt.event.ActionEvent;
37-
import java.awt.event.ActionListener;
3836
import java.awt.event.FocusEvent;
3937
import java.awt.event.FocusListener;
4038

@@ -51,12 +49,9 @@ public FilterJTextField(String hint) {
5149

5250
showingHint = true;
5351
updateStyle();
54-
timer = new Timer(1000, new ActionListener() {
55-
@Override
56-
public void actionPerformed(ActionEvent e) {
57-
applyFilter();
58-
timer.stop();
59-
}
52+
timer = new Timer(1000, e -> {
53+
applyFilter();
54+
timer.stop();
6055
});
6156

6257
addFocusListener(new FocusListener() {
@@ -90,14 +85,11 @@ public void changedUpdate(DocumentEvent e) {
9085
}
9186
});
9287

93-
addActionListener(new ActionListener() {
94-
@Override
95-
public void actionPerformed(ActionEvent e) {
96-
if (timer.isRunning()) {
97-
timer.stop();
98-
}
99-
applyFilter();
88+
addActionListener(e -> {
89+
if (timer.isRunning()) {
90+
timer.stop();
10091
}
92+
applyFilter();
10193
});
10294
}
10395

0 commit comments

Comments
 (0)