|
@@ -101,9 +101,9 @@ public class SettingsWindow extends JDialog {
|
|
|
|
|
|
// Create text field
|
|
|
JTextField textField = createTextField(Integer.toString(value));
|
|
|
- textField.addActionListener((e) -> {
|
|
|
+ textField.getDocument().addDocumentListener((SimpleDocumentListener)(e) -> {
|
|
|
if (listener != null) {
|
|
|
- String text = ((JTextField) e.getSource()).getText();
|
|
|
+ String text = textField.getText();
|
|
|
try {
|
|
|
listener.accept(Integer.parseInt(text));
|
|
|
}
|
|
@@ -125,9 +125,9 @@ public class SettingsWindow extends JDialog {
|
|
|
|
|
|
// Create text field
|
|
|
JTextField textField = createTextField(Double.toString(value));
|
|
|
- textField.addActionListener((e) -> {
|
|
|
+ textField.getDocument().addDocumentListener((SimpleDocumentListener)(e) -> {
|
|
|
if (listener != null) {
|
|
|
- String text = ((JTextField) e.getSource()).getText();
|
|
|
+ String text = textField.getText();
|
|
|
try {
|
|
|
listener.accept(Double.parseDouble(text));
|
|
|
}
|