This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Focuse object" Watch "Focuse object" New topic

Focuse object

Talha-bin -Shakir
Ranch Hand

Joined: Jan 26, 2006
Posts: 32
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.

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
I agree. Here's the link:
subject: Focuse object
jQuery in Action, 3rd edition