aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Focuse object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Focuse object" Watch "Focuse object" New topic
Author

Focuse object

Talha-bin -Shakir
Ranch Hand

Joined: Jan 26, 2006
Posts: 32
Hi,
i have few textfields on my frame. I want to know the textfield name which is currently focused. can someone please help me. How to know the current focused object name.

Thanks
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
this will give you the focus owner
Component currentFocusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();

Component has a getName(), but you would be responsible for setting the name
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Focuse object