Node node = getScene().getFocusOwner(); if (node instanceof DateCell) { currentFocusedDayCell = (DateCell) node;
Scene scene = fields[0].getScene(); Node focusOwner = scene.getFocusOwner(); if (focusOwner instanceof TextField) { TextField focusedField = (TextField) focusOwner; ... }
public static <T> void registerAccelerator(Scene scene, KeyCodeCombination key, Class<T> aClass, Consumer<T> a) { scene.getAccelerators().put(key, () -> { Node node = scene.getFocusOwner(); while (node != null) { if (aClass.isAssignableFrom(node.getClass())) { a.accept((T) node); break; } node = node.getParent(); } }); }
private void validateButton( ButtonType buttonType, BooleanSupplier condition) { Button btn = (Button)dialog.getDialogPane().lookupButton(buttonType); if ( btn != null ) { Node focusOwner = (btn.getScene() != null) ? btn.getScene().getFocusOwner() : null; btn.setDisable(condition.getAsBoolean()); if(focusOwner != null) { focusOwner.requestFocus(); } } }
for (Node n = scene.getFocusOwner(); n!= null ; n=n.getParent()) { if (n == textArea) return true ;
@Override public void fire() { if (!isFocusTraversable() && !isCancelButton()) { /* * If the button is not focus traversable, it will not receive the focus when clicked. * As a consequence, an opposite FxComponent will not lose its focus which in turn * means, that the model is not updated. If the action handler of this button * depends on it, it will not see the last user's input. * In such cases we must perform the model update explicitly before firering the event. */ Node node = getScene().getFocusOwner(); if (node instanceof FxComponent) { FxUtilities.getInstance().focusLost((FxComponent) node); } } super.fire(); }
activeDockable.addListener((observable, oldValue, newValue) -> { if (newValue != null) { final Node currentFocusOwner = newValue.getDockable().getScene().getFocusOwner(); if (currentFocusOwner == null || !isFocusInDockable(newValue.getDockable(), currentFocusOwner)) { LOG.debug("Request focus for new active Dockable: '{}'!", newValue.getDockableData().getTitle());
Scene scene = getNode().getScene(); if (scene != null) { Node node = scene.getFocusOwner(); if (node != getNode() && (!(node instanceof FxComponent) || ((FxComponent) node).getError() == null)) {
Node node = getScene().getFocusOwner(); if (node instanceof DateCell) { currentFocusedDayCell = (DateCell) node;