Example usage for javafx.scene Node requestFocus

List of usage examples for javafx.scene Node requestFocus

Introduction

In this page you can find the example usage for javafx.scene Node requestFocus.

Prototype

public void requestFocus() 

Source Link

Document

Requests that this Node get the input focus, and that this Node 's top-level ancestor become the focused window.

Usage

From source file:ambroafb.general.AnnotiationUtils.java

private static void changeNodeTitleLabelVisual(Node node, String explain) {
    Parent parent = node.getParent();/*from  ww w  .  ja  v a  2s . c  o  m*/
    Label nodeTitleLabel = (Label) parent.lookup(".validationMessage");

    if (explain.isEmpty()) {
        if (default_colors_map.containsKey(nodeTitleLabel)) {// This order of 'if' statements is correct!
            nodeTitleLabel.setTextFill(default_colors_map.get(nodeTitleLabel));
            default_colors_map.remove(nodeTitleLabel);
            Tooltip.uninstall(nodeTitleLabel, toolTip);
        }
    } else {
        node.requestFocus();
        toolTip.setText(GeneralConfig.getInstance().getTitleFor(explain));
        toolTip.setStyle("-fx-background-color: gray; -fx-font-size: 8pt;");
        Tooltip.install(nodeTitleLabel, toolTip);
        default_colors_map.putIfAbsent(nodeTitleLabel, nodeTitleLabel.getTextFill());
        nodeTitleLabel.setTextFill(Color.RED);
    }
}