This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes static method getFocusedComponent() of JTextComponent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "static method getFocusedComponent() of JTextComponent" Watch "static method getFocusedComponent() of JTextComponent" New topic
Author

static method getFocusedComponent() of JTextComponent

Jim Martin
Ranch Hand

Joined: Oct 31, 2002
Posts: 80
Hi all
How do I use the static method getFocusedComponent() of JTextComponent. I am using JBuilder 6.0.
I am using the class DefaultFocusManager() and I am trying to used the static method getFocusedComponent() of JTextComponent to get the component the currently has the focus.
What is another way to get the component that has the focus currently?
Thank you very much
Howard Zhao
Greenhorn

Joined: May 06, 2002
Posts: 27
I am not sure whether this is what you are looking for:
KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()
Howard
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: static method getFocusedComponent() of JTextComponent