• Post Reply Bookmark Topic Watch Topic
  • New Topic

Focus on a JTExtField  RSS feed

 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,


I am new to the Swing development...I have the task of debugging a swing app,The problem is that i would likee to take the cursor focus back to the username JTextField in case of an invalid login.

As of now,the focus automatically wrests on the second JtextField -password in case of an invalid login.

Thanks in advance,
Bye all,
ARK.
 
Eddie Vanda
Ranch Hand
Posts: 283
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ARKumar,

You could use "userName.grabFocus ()" when your login fails. I think there are also other ways to manage focus but that one works for me!

Ed
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!