File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • 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
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try inserting.. "\n\r"
 
Rob Camick
Ranch Hand
Posts: 2474
8
  • 0
  • 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