Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

TextField select cursor placement???  RSS feed

 
Dylan Margoczi
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there...

I just want to know how its possible to select text in a JTextField and place the cursor at the beginning of the selection.
I tried doing the selection using textfield.select(2,5);
then placing the cursor using textfield.setCaretPosition(2);
this places the cursor but takes away my selection

What to do, what to do???

thanks Dylan...
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this will select 'World', with the caret just before 'W'

 
Dylan Margoczi
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
T
 
Dylan Margoczi
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help...
all sorted...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!