-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
None
There are several common use cases for wanting to get the keyboard focus owner in a scene. Two common ones are for the authoring tool and accessibility.
The proposed solution to this would be to promote impl_getFocusOwner to public API, but it looks like it may not be so trivial. Currently, the focus owner is handled in a couple different ways in Scene.java:
/**
* Gets the scene's current focus owner node.
*
* TODO: probably should be removed in favor of impl_focusOwner below.
*
* @treatasprivate implementation detail
*/
public Node impl_getFocusOwner() {
return getKeyHandler().getFocusOwner();
}
/**
* The scene's current focus owner node. This node's "focused"
* variable might be false if this scene has no window, or if the
* window is inactive (window.focused == false).
*
* TODO this was added because ofRT-3930. This needs to be reconciled
* with impl_getFocusOwner(). We don't need both. Exposing a variable
* is more powerful because it allows code to bind to it.
*
* @treatasprivate implementation detail
*/
//
private @GenerateProperty Node impl_focusOwner;
So, there seems to be opportunity here to clean things up in addition to exposing public API.
The proposed solution to this would be to promote impl_getFocusOwner to public API, but it looks like it may not be so trivial. Currently, the focus owner is handled in a couple different ways in Scene.java:
/**
* Gets the scene's current focus owner node.
*
* TODO: probably should be removed in favor of impl_focusOwner below.
*
* @treatasprivate implementation detail
*/
public Node impl_getFocusOwner() {
return getKeyHandler().getFocusOwner();
}
/**
* The scene's current focus owner node. This node's "focused"
* variable might be false if this scene has no window, or if the
* window is inactive (window.focused == false).
*
* TODO this was added because of
* with impl_getFocusOwner(). We don't need both. Exposing a variable
* is more powerful because it allows code to bind to it.
*
* @treatasprivate implementation detail
*/
//
private @GenerateProperty Node impl_focusOwner;
So, there seems to be opportunity here to clean things up in addition to exposing public API.
- duplicates
-
JDK-8102095 Need a way to know currently focused component
- Closed
-
JDK-8101099 Get the focused node in an Application
- Closed