File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Cursor handling in JTextArea Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Cursor handling in JTextArea" Watch "Cursor handling in JTextArea" New topic

Cursor handling in JTextArea

kumar mars
Ranch Hand

Joined: Jun 04, 2001
Posts: 34
is there any way to dictate the movement of the cursor in JTextArea.
thanks in anticipation

Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

Here is a short program to show the use of the setCaretPosition() method of the JTextArea. This sets the position of the cursor (caret) in the JTextArea...

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
kumar mars
Ranch Hand

Joined: Jun 04, 2001
Posts: 34
it doesnt suffise setting cursor position in terms of index
i need some way to specify the position exactly in tersms of pixels or some thing of that kind
I agree. Here's the link:
subject: Cursor handling in JTextArea
It's not a secret anymore!