0

hello all

I have one textField and one textArea.
How to move the cursor to the end of Text of TextArea
when
-cursor is in textField,and keyboard [Enter] pressed

thank you
denny

4
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by dennysimon
0

My suggestion:

1. Add ActionListener to textField.
2. When actionPerformed(), move the cursor to textArea using textArea.grabFocus().
3. If you want to place the cursor at the end of the text of textArea, use select() method.

Edited by leodash: n/a

1

you can use Focus, but for JTextComponent is there DocumentListener + Caret for JTextArea

myTextArea.setCaretPosition(textArea.getDocument().getLength());

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.