<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
No, the code that calls setText() is where it starts.<br>
<br>
-phil.<br>
<br>
<div class="moz-cite-prefix">On 11/17/23 2:51 AM, Nikita Provotorov
wrote:<br>
</div>
<blockquote type="cite" cite="mid:CAMTdVerbDWuq9s6yzcJYnChbefZGBSj-zJ2mxt7LbgCisK52_A@mail.gmail.com">
<div dir="ltr">
<div>Thanks for the response!</div>
<div>However I'd like to clarify: is it correct to say that the
current implementation of <a href="https://github.com/openjdk/jdk/blob/8ec6b8de3bb3d7aeebdcb45d761b18cce3bab75e/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java#L258" moz-do-not-send="true">sun.awt.X11.XTextAreaPeer#repaintText</a> is
wrong because it doesn't make sure if <i>javax.swing.JComponent#paintImmediately</i>
is called on EDT only<span class="gmail-Apple-converted-space"> </span>(e.g.
via<span class="gmail-Apple-converted-space"> </span><i>SwingUtilities#invokeLater</i>)?</div>
<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>
<br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, Nov 16, 2023 at
9:30 PM Philip Race <<a href="mailto:philip.race@oracle.com" moz-do-not-send="true" class="moz-txt-link-freetext">philip.race@oracle.com</a>>
wrote:<br>
</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">
<div> 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>On 11/15/23 4:01 PM, Nikita Provotorov wrote:<br>
</div>
<blockquote type="cite">
<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">
<div dir="ltr">Best regards,
<div>Nikita Provotorov</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</div>
</blockquote>
</div>
</blockquote>
<br>
</body>
</html>