Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

to set Focus on JTextField..

843806Jan 3 2008 — edited Jan 6 2008
Hi,

I have a swing app and it has a JTextField and a JButton.

When the application starts, I want the cursor to already blink at the starting position. Presently I need to click on the JTextField and then the cursor comes. How do I solve this?

When the JButton is clicked "a" is added at the end of the text in the JTextField. Well and good. But then again the cursor disappears as soon as I click on the Button.. to get the cursor back in the text field .. i need to manually click on it and then the cursor starts blinking... I would like to have something like.. when I click the button the "a" character is added at the end of the text and ten the cursor automatically starts blinking.

How do I go about solving these two issues.. ( although I believe.. both these problems require only one solution.. )

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 3 2008
Added on Jan 3 2008
5 comments
1,130 views