This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to set the cursor position to new line when a specific char is typed

 
Karnati Sudhakar
Ranch Hand
Posts: 270
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a specific requirement that when user types a specific character..cursor should go to the next line..

I have code like this



what happening now is when i type ~ a new line is added but cursor is not moving to the next line..

Please suggest me..
 
Chinna Eranna
Ranch Hand
Posts: 174
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try inserting.. "\n\r"
 
Rob Camick
Ranch Hand
Posts: 2600
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe you also need:

textArea.setCaretPosition( current position + 1);
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic