Source:
<code>private Group createTaskIndicator() { ProgressIndicator indicator = new ProgressIndicator(); indicator.getStyleClass().add("progress-indicatorToolbar"); indicator.progressProperty().bind(stateManager.getTasksProgress()); Tooltip someTasksRunning = new Tooltip(Localization.lang("Background Tasks are running")); Tooltip noTasksRunning = new Tooltip(Localization.lang("Background Tasks are done")); indicator.setTooltip(noTasksRunning); stateManager.getAnyTaskRunning().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue.booleanValue()) { indicator.setTooltip(someTasksRunning); } else { indicator.setTooltip(noTasksRunning); } } }); indicator.widthProperty().addListener((observable, oldValue, newValue) -> { if (!indicator.isIndeterminate()) { indicator.setPrefWidth(newValue.doubleValue()); } if (newValue.doubleValue() > 0) { Rectangle clip = new Rectangle(newValue.doubleValue(), newValue.doubleValue()); indicator.setClip(clip); } }); indicator.setOnMouseClicked(event -> { TaskProgressView taskProgressView = new TaskProgressView(); EasyBind.listBind(taskProgressView.getTasks(), stateManager.getBackgroundTasks()); taskProgressView.setRetainTasks(true); taskProgressView.setGraphicFactory(BackgroundTask::getIcon); PopOver progressViewPopOver = new PopOver(taskProgressView); if (this.existedProgressViewPopOver == null) { this.existedProgressViewPopOver = progressViewPopOver; } progressViewPopOver.setTitle(Localization.lang("Background Tasks")); progressViewPopOver.setArrowLocation(PopOver.ArrowLocation.RIGHT_TOP); <START> this.existedProgressViewPopOver.hide(); <END> progressViewPopOver.show(indicator); this.existedProgressViewPopOver = progressViewPopOver; }); return new Group(indicator); }</code><technical_language>Another option reuse existing pop change content. is: if (existedProgressViewPopOver == null) { existedProgressViewPopOver = new ... } else { existedProgressViewPopOver.setContentNode(taskProgressView). } This a slightly user experience is flicker of hiding/showing a new pop over. rename global variable progressViewPopOver</technical_language>

Target:
private Group createTaskIndicator() { ProgressIndicator indicator = new ProgressIndicator(); indicator.getStyleClass().add("progress-indicatorToolbar"); indicator.progressProperty().bind(stateManager.getTasksProgress()); Tooltip someTasksRunning = new Tooltip(Localization.lang("Background Tasks are running")); Tooltip noTasksRunning = new Tooltip(Localization.lang("Background Tasks are done")); indicator.setTooltip(noTasksRunning); stateManager.getAnyTaskRunning().addListener((observable, oldValue, newValue) -> { if (newValue) { indicator.setTooltip(someTasksRunning); } else { indicator.setTooltip(noTasksRunning); } }); indicator.widthProperty().addListener((observable, oldValue, newValue) -> { if (!indicator.isIndeterminate()) { indicator.setPrefWidth(newValue.doubleValue()); } if (newValue.doubleValue() > 0) { Rectangle clip = new Rectangle(newValue.doubleValue(), newValue.doubleValue()); indicator.setClip(clip); } }); indicator.setOnMouseClicked(event -> { TaskProgressView<Task<?>> taskProgressView = new TaskProgressView<>(); EasyBind.listBind(taskProgressView.getTasks(), stateManager.getBackgroundTasks()); taskProgressView.setRetainTasks(true); taskProgressView.setGraphicFactory(BackgroundTask::getIcon); if (progressViewPopOver == null) { progressViewPopOver = new PopOver(taskProgressView); progressViewPopOver.setTitle(Localization.lang("Background Tasks")); progressViewPopOver.setArrowLocation(PopOver.ArrowLocation.RIGHT_TOP); progressViewPopOver.setContentNode(taskProgressView); progressViewPopOver.show(indicator); } else if (progressViewPopOver.isShowing()) { progressViewPopOver.hide(); } else { progressViewPopOver.setContentNode(taskProgressView); progressViewPopOver.show(indicator); } }); return new Group(indicator); }