diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index 60d324112b..74bf3fe76f 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -7,7 +7,6 @@ import com.fr.base.ParameterMapNameSpace; import com.fr.base.TableDataNameSpace; import com.fr.base.Utils; import com.fr.base.io.IOFile; -import com.fr.concurrent.NamedThreadFactory; import com.fr.data.TableDataSource; import com.fr.design.actions.UpdateAction; import com.fr.design.border.UIRoundedBorder; @@ -116,8 +115,6 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; /** * 公式编辑面板 @@ -296,17 +293,8 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { refocusInWindow(); } - private void refocusInWindow() { - ExecutorService executorService = Executors.newCachedThreadPool(new NamedThreadFactory("formula-pane-refocus")); - executorService.execute(() -> { - try { - Thread.sleep(100); - formulaTextArea.requestFocusInWindow(); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - }); - executorService.shutdown(); + public void refocusInWindow() { + SwingUtilities.invokeLater(() -> formulaTextArea.requestFocusInWindow()); } private void initVariableTreeAndDescriptionArea() {