• Post Reply Bookmark Topic Watch Topic
  • New Topic

SET FOCUS  RSS feed

 
Mike London
Ranch Hand
Posts: 1441
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There doesn't seem to be a simple way to say something like this:
SomeControl.setFocus(true);
It seems you have to understand something called a "focus transversal policy" just to set focus to a control.
I can't seem to find any good information on how to do what, IMHO, should be straightforward.
While I understand the power that the current J2SE 1.42 gives me, I still think there should be simple ways of doing what you need to do most of the time (as in "someControl.setFocus()").
Am I missing something?
Thanks for any info!
--Mike
 
Manuel Moons
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you try using the requestFocus() method (it is inherited from Component)
 
Mike London
Ranch Hand
Posts: 1441
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, but requestFocus() doesn't *set* the focus -- at least for me.
I want to be able to put the focus into a control from the validation logic in some method.
Thanks for your reply.
 
Mike London
Ranch Hand
Posts: 1441
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Manuel,
It turned out your suggestion worked after all.
Thank you very much!!!
-- Mike
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!