JTextArea.append thread safety

The java document says the append method is thread safe. However, I remember that when I tried to add to the text area from different streams (several months ago), I get mixed text in which stream 1 will add some characters, and in stream 2 some other characters will be added. So instead of getting STRINGstring in jtextarea, I get SstTrRINingG.

What differences may be between:

  • add sync
  • bottlenecking is added from different threads through threadpoolexecutor.
  • using invokeLater on EDT

Or are they all suitable for fixing the problem? Thanks

+5
source share
2 answers
+7

. - Invoke , invokeLater, .

+1

All Articles