wood burning stoves 2.0*
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
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
 
Similar Threads
Oracle Certification Site Similar to Javaranch
Prototype and JQuery
* Welcome Larry Aronson
button focused
xml certificate kinds