• Post Reply Bookmark Topic Watch Topic
  • New Topic

can't set cursor placement when clicking in a JFormattedTextField...

 
Grary Stimon
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ranchers,

I have a small but persistent problem. I have a JFormattedTextField created with a MaskFormatter, so that it will only accept eight characters for input.

My problem is that, unlike for other simple JTextField objects in my panel, when I cursor-click into this JFormattedTextField the cursor will start at various positions
within the field, not always at the initial, left-most position as I desire.

Any thoughts?

Thanks,

Grary
 
Rob Spoor
Sheriff
Posts: 20817
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a FocusListener combined with the setCaretPosition method perhaps?
 
Grary Stimon
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob,

Thanks. Didn't work. Here's what I did...

Problem remains: when I click onto field, cursor doesn't position at left-most (0) position (when I tab to the field I get normal expected positioning.)

Thanks for any further suggestions.

Grary
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!