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

Recommended Answers

All 4 Replies

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.

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

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

big thanks for all of you
denny

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.