From abb65372d6035912f8b017702a9db333dfadab92 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Sun, 18 Oct 2015 19:02:34 -0400 Subject: [PATCH] auto-sync --- .../ui/src/com/rusefi/ui/widgets/AnyCommand.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/java_console/ui/src/com/rusefi/ui/widgets/AnyCommand.java b/java_console/ui/src/com/rusefi/ui/widgets/AnyCommand.java index 2db07d734d..26371a04c2 100644 --- a/java_console/ui/src/com/rusefi/ui/widgets/AnyCommand.java +++ b/java_console/ui/src/com/rusefi/ui/widgets/AnyCommand.java @@ -7,6 +7,7 @@ import com.rusefi.ui.storage.Node; import javax.swing.*; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; +import javax.swing.text.JTextComponent; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -47,7 +48,7 @@ public class AnyCommand { go.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - go(); + send(); } }); content.add(go); @@ -76,7 +77,7 @@ public class AnyCommand { text.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - go(); + send(); } }); text.getDocument().addDocumentListener(new DocumentListener() { @@ -109,7 +110,7 @@ public class AnyCommand { // todo: limit the length of text in the text field } - private void go() { + private void send() { index = 0; String cmd = text.getText(); if (!isValidInput(text)) @@ -120,11 +121,7 @@ public class AnyCommand { reentrant = false; } - public JTextField getText() { - return text; - } - - private static boolean isValidInput(JTextField text) { + private static boolean isValidInput(JTextComponent text) { boolean isOk = true; for (char c : text.getText().toCharArray()) { if (c > 127) {