<Swing Dev> Request review for 7129742 : Unable to view focus in Non-Editable TextArea

Pavel Porvatov pavel.porvatov at oracle.com
Tue Mar 13 13:49:34 UTC 2012


Hi Sean,

I have a couple questions about the following code in the 
XTextAreaPeer.java class
+        // visible caret has a timer thread, which must be stopped
+        jtext.getCaret().setVisible(false);

1. Why this code wasn't needed before your fix, when caret was visible 
for enabled text area?
2. Why don't we need the same code in the XTextFieldPeer class?

About the bug7129742 test:
Because of the passed field is used from different threads you must use 
synchronization or mark the field as a volatile.

Regards, Pavel

> Hi Alexander,
>
>     XTextFieldPeer and   XTextAreaPeer have a same inner 
> class XAWTCaret, and in  XTextAreaPeer  there is also a comment:
> "// TODO : fix this duplicate code "   before XAWTCaret . So I removed 
> the XAWTCaret in XTextFieldPeer and changed the
> XAWTCaret  into a static class, so XTextFieldPeer can 
> use XAWTCaret from XTextAreaPeer  .
>
>     As XAWTCaret is only used in the following 
> method  in both XTextAreaPeer and  XTextFieldPeer .
> protected Caret createCaret() {
>  return new XAWTCaret();
>  }
>     I think this modification should not bring side effect.
>
> On Mon, Mar 12, 2012 at 1:27 AM, Alexander Potochkin 
> <Alexander.Potochkin at oracle.com 
> <mailto:Alexander.Potochkin at oracle.com>> wrote:
>
>     Hello Sean
>
>     Could you give more details about your changes in XTextFieldPeer?
>
>     Thanks
>     alexp
>
>         Hi all,
>
>           I updated the patch to as suggested and simplified the
>         testcase .
>         Would anyone like to take a look again ? Thanks.
>
>          The webrev is at :
>         http://cr.openjdk.java.net/~zhouyx/7129742/webrev.04/
>         <http://cr.openjdk.java.net/%7Ezhouyx/7129742/webrev.04/>
>         <http://cr.openjdk.java.net/%7Ezhouyx/7129742/webrev.04/>
>
>
>          Previous discussion at :
>         http://mail.openjdk.java.net/pipermail/swing-dev/2012-February/001913.html
>
>         -- 
>         Best Regards,
>         Sean Chou
>
>
>
>
>
> -- 
> Best Regards,
> Sean Chou
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20120313/568637b6/attachment.html>


More information about the swing-dev mailing list