diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/TextTranslatableComponent.java b/Core/src/org/sleuthkit/autopsy/contentviewers/TextTranslatableComponent.java index 801647e679..74f2fddf03 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/TextTranslatableComponent.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/TextTranslatableComponent.java @@ -22,6 +22,7 @@ import java.awt.Component; import java.util.logging.Level; import javax.swing.JScrollPane; import javax.swing.JTextArea; +import javax.swing.SwingUtilities; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.texttranslation.NoServiceProviderException; @@ -103,12 +104,15 @@ final class TextTranslatableComponent implements TranslatablePanel.TranslatableC this.translate = translate; if (this.translate) { if (this.translated == null) { - try { - this.translated = this.translationService.translate(this.origContent); - } catch (NoServiceProviderException | TranslationException ex) { - LOGGER.log(Level.WARNING, "Unable to translate text with translation service", ex); - return Bundle.TextTranslatableComponent_setTranslated_onTranslateError(); - } + final String originalContent = this.origContent; + SwingUtilities.invokeLater(() -> { + try { + this.translated = this.translationService.translate(originalContent); + } catch (NoServiceProviderException | TranslationException ex) { + LOGGER.log(Level.WARNING, "Unable to translate text with translation service", ex); + return Bundle.TextTranslatableComponent_setTranslated_onTranslateError(); + } + }); } return onErr(setPanelContent(this.translated == null ? "" : this.translated)); } else {