List of usage examples for javafx.scene.control Control disabledProperty
public final ReadOnlyBooleanProperty disabledProperty()
From source file:gov.va.isaac.gui.util.ErrorMarkerUtils.java
/** * Setup an 'INFORMATION' info marker on the component. Automatically displays anytime that the initialControl is disabled. * Put the initial control in the provided stack pane *//*from ww w. j av a2s. c om*/ public static Node setupDisabledInfoMarker(Control initialControl, StackPane stackPane, ObservableStringValue reasonWhyControlDisabled) { ImageView information = Images.INFORMATION.createImageView(); information.visibleProperty().bind(initialControl.disabledProperty()); Tooltip tooltip = new Tooltip(); tooltip.textProperty().bind(reasonWhyControlDisabled); Tooltip.install(information, tooltip); tooltip.setAutoHide(true); information.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { tooltip.show(information, event.getScreenX(), event.getScreenY()); } }); stackPane.setMaxWidth(Double.MAX_VALUE); stackPane.getChildren().add(initialControl); StackPane.setAlignment(initialControl, Pos.CENTER_LEFT); stackPane.getChildren().add(information); if (initialControl instanceof Button) { StackPane.setAlignment(information, Pos.CENTER); } else if (initialControl instanceof CheckBox) { StackPane.setAlignment(information, Pos.CENTER_LEFT); StackPane.setMargin(information, new Insets(0, 0, 0, 1)); } else { StackPane.setAlignment(information, Pos.CENTER_RIGHT); double insetFromRight = (initialControl instanceof ComboBox ? 30.0 : 5.0); StackPane.setMargin(information, new Insets(0.0, insetFromRight, 0.0, 0.0)); } return stackPane; }