<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    Because (like in this case), an AWT component might actually be
    implemented using Swing,<br>
    the recommendation is to treat AWT components like Swing, and update
    them only on the EDT.<br>
    <br>
    -phil.<br>
    <br>
    <div class="moz-cite-prefix">On 11/15/23 4:01 PM, Nikita Provotorov
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CAMTdVeoVr=xzqsMHXeLdZR09G+O8U_AtwTTGS6xPj2PXTheWJw@mail.gmail.com">
      
      <div dir="ltr">
        <div>Hello!<br>
        </div>
        <div>I've discovered that on X11 platforms a call
          of java.awt.TextComponent#setText can lead to a call
          of javax.swing.JComponent#paintImmediately(java.awt.Rectangle)
          on the same thread.</div>
        <div>Since java.awt.TextComponent#setText is allowed to be
          called on any thread (because it's AWT, not Swing),
          JComponent#paintImmediately may be called outside of EDT. Is
          this a valid behavior?</div>
        <div><br>
        </div>
        <div>The following stacktrace shows how exactly this can happen:</div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">at
          javax.swing.JComponent.paintImmediately<br>
          at sun.awt.X11.XTextAreaPeer$AWTTextArea.repaintNow<br>
          at sun.awt.X11.XTextAreaPeer.repaintText<br>
          at sun.awt.X11.XTextAreaPeer.setText<br>
          at java.awt.TextComponent.setText</blockquote>
        <br clear="all">
        <div>
          <div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">
            <div dir="ltr">Best regards,
              <div>Nikita Provotorov</div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>