1
I’m having trouble to "set" the cursor at the beginning of the field, using the setCaretPosition(0); in Textfield fields, it works correctly, but in any field with masking (Jformattedtextfield type), it does not work.
Can anyone tell me why ?
1
I’m having trouble to "set" the cursor at the beginning of the field, using the setCaretPosition(0); in Textfield fields, it works correctly, but in any field with masking (Jformattedtextfield type), it does not work.
Can anyone tell me why ?
Browser other questions tagged java swing
You are not signed in. Login or sign up in order to post.
Doesn’t work like?
– Jéf Bueno
It does not arrow the cursor at the beginning of the field, in the case at position 0.
– user59450
And arrow to somewhere? Does it make a mistake? Or just does nothing?
– Jéf Bueno
He doesn’t make mistakes. It simply does not do what it should, when using setCaretPosition(0); it should set the cursor at the beginning of the field when it wins focused. And in my fields with mascara, it does not do this, if you click on the field the cursor stays where you clicked.
– user59450
I think you need to set a Document so that the cursor always starts at the beginning.
– user28595
Could you please post one MVCE demonstrating the problem? I could not play here (Java 8, in openSuse).
– Anthony Accioly
@diegofm only make a extends of Plaindocument solves ?
– user59450
http://stackoverflow.com/a/2202073/5524514
– user28595