Reputation: 3
I have a program that creates a new text area on a JFrame
where ever I left click. However, I always need to click the text area again in order to move the cursor there to type.
I was wondering how I could automatically set the cursor in the text area each time I create a new one without having to click again. How to set cursor in new text areas?
Upvotes: 0
Views: 52
Reputation: 4090
As Andrew Thompson has suggested:
You should use the following method in order to set the cursor in new text areas (note the link to docs.oracle.com) - requestFocusInWindow()
Upvotes: 2