List of usage examples for javafx.scene.control Tooltip isActivated
public final boolean isActivated()
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setWidth(300);// w w w . ja va2 s . c o m stage.setHeight(150); Button button = new Button("Hover Over Me"); Tooltip toolTip = new Tooltip("Tooltip for Button"); System.out.println(toolTip.isActivated()); button.setTooltip(toolTip); ((Group) scene.getRoot()).getChildren().add(button); stage.setScene(scene); stage.show(); }
From source file:com.wineshop.client.Home.java
@Override public void initialize(URL url, ResourceBundle bundle) { // Setup of the table view vineyards.setSortAdapter(new TableViewSortAdapter<Vineyard>(tableVineyards, Vineyard.class)); vineyards.getFilter().nameProperty().bindBidirectional(fieldSearch.textProperty()); // Setup of the creation/edit form labelFormVineyard.textProperty()//from ww w.j a v a2 s.c o m .bind(Bindings.when(vineyard.savedProperty()).then("Edit vineyard").otherwise("Create vineyard")); vineyard.instanceProperty().addListener(new ChangeListener<Vineyard>() { @Override public void changed(ObservableValue<? extends Vineyard> observable, Vineyard oldValue, Vineyard newValue) { if (oldValue != null) { fieldName.textProperty().unbindBidirectional(oldValue.nameProperty()); fieldAddress.textProperty().unbindBidirectional(oldValue.getAddress().addressProperty()); listWines.setItems(null); } if (newValue != null) { fieldName.textProperty().bindBidirectional(newValue.nameProperty()); fieldAddress.textProperty().bindBidirectional(newValue.getAddress().addressProperty()); listWines.setItems(newValue.getWines()); } } }); // Define the cell factory for the list of wines listWines.setCellFactory(new Callback<ListView<Wine>, ListCell<Wine>>() { public ListCell<Wine> call(ListView<Wine> listView) { return new WineListCell(); } }); buttonDelete.visibleProperty().bind(vineyard.savedProperty()); buttonDelete.disableProperty().bind(Bindings.not(identity.ifAllGranted("ROLE_ADMIN"))); buttonSave.disableProperty().bind(Bindings.not(vineyard.dirtyProperty())); buttonCancel.disableProperty() .bind(Bindings.not(Bindings.or(vineyard.savedProperty(), vineyard.dirtyProperty()))); // Link the table selection and the entity instance in the form select(null); tableVineyards.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Vineyard>() { @Override public void changed(ObservableValue<? extends Vineyard> property, Vineyard oldSelection, Vineyard newSelection) { select(newSelection); } }); formVineyard.addEventHandler(ValidationResultEvent.INVALID, new EventHandler<ValidationResultEvent>() { @Override public void handle(ValidationResultEvent event) { ((Node) event.getTarget()).setStyle("-fx-border-color: red"); if (event.getTarget() instanceof TextInputControl && event.getErrorResults() != null && event.getErrorResults().size() > 0) { Tooltip tooltip = new Tooltip(event.getErrorResults().get(0).getMessage()); tooltip.setAutoHide(true); ((TextInputControl) event.getTarget()).setTooltip(tooltip); } } }); formVineyard.addEventHandler(ValidationResultEvent.VALID, new EventHandler<ValidationResultEvent>() { @Override public void handle(ValidationResultEvent event) { ((Node) event.getTarget()).setStyle("-fx-border-color: null"); if (event.getTarget() instanceof TextInputControl) { Tooltip tooltip = ((TextInputControl) event.getTarget()).getTooltip(); if (tooltip != null && tooltip.isActivated()) tooltip.hide(); ((TextInputControl) event.getTarget()).setTooltip(null); } } }); }