aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How to set the cursor position to new line when a specific char is typed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to set the cursor position to new line when a specific char is typed" Watch "How to set the cursor position to new line when a specific char is typed" New topic
Author

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

Karnati Sudhakar
Ranch Hand

Joined: Aug 26, 2008
Posts: 270

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..


Regards
Sudhakar
Chinna Eranna
Ranch Hand

Joined: Dec 08, 2009
Posts: 174

try inserting.. "\n\r"


- Chinna
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2200
    
    7
Maybe you also need:

textArea.setCaretPosition( current position + 1);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to set the cursor position to new line when a specific char is typed