If this is a Swing "feature", then I'm not aware of a simple setting
somewhere (maybe someone else knows of one?). I do know that
DefaultCaret has a setUpdatePolicy method. You would have to get the
Caret from the JTextField, make sure it is a DefaultCaret, cast it to
DefaultCaret, and invoke setUpdatePolicy(DefaultCaret.NEVER_UPDATE).
Even then, I haven't tested this, so I'm not sure if it would have the
desired effect. Another approach would be to implement a
FormComponentInterceptor that automatically handles any JTextField that
is not enabled so that the caret it always placed at the beginning of
the field. See SelectAllFormComponentInterceptorFactory for an example
of what an interceptor looks like.
- Andy
Benoit Xhenseval wrote:
>
> Hi *,
>
>
>
> Sorry to disturb.
>
>
>
> I have a form that displays fields from a model. I have some text
> components that are readonly
> (formModel.getFieldMetaData().setReadOnly(true);
>
>
>
> Sometimes the text MAY be too long for the field, and that is ok, the
> user could scroll. The problem is that the caret seems always to be
> positioned at the end of the text, like this:
>
>
>
>
>
> This is ok when one types some text.
>
>
>
> But, since the text is readonly true, I would like, by default, the
> caret to be place at position 0, like this:
>
>
>
>
>
> Is there a way (i.e. a setting? Or where to changed this…) to achieve
> this by default for all fields with READONLY metadata set to true?
>
>
>
> Suggestions would be greatly welcomed!
>
>
>
> many thanks,
>
>
>
> regards from London
>
>
>
> Benoit
>
>
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.485 / Virus Database: 269.13.6/991 - Release Date:
> 05/09/2007 14:55
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> ------------------------------------------------------------------------
>
> _______________________________________________
> Springframework-rcp-dev mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-rcp-dev
>
|