private void updateRecentFilesMenu() { List<MenuItem> items = new ArrayList<>(); List<File> filesToClear = new ArrayList<>(); for (final File f : recentFiles) { if (f.exists() && f.isFile()) { CustomMenuItem item = new CustomMenuItem(new Label(f.getName())); item.setOnAction(e -> loadSourceFromFile(f)); item.setMnemonicParsing(false); Tooltip.install(item.getContent(), new Tooltip(f.getAbsolutePath())); items.add(item); } else { filesToClear.add(f); } } recentFiles.removeAll(filesToClear); if (items.isEmpty()) { openRecentMenu.setDisable(true); return; } Collections.reverse(items); items.add(new SeparatorMenuItem()); MenuItem clearItem = new MenuItem(); clearItem.setText("Clear menu"); clearItem.setOnAction(e -> { recentFiles.clear(); openRecentMenu.setDisable(true); }); items.add(clearItem); openRecentMenu.getItems().setAll(items); }
Tooltip.install(this, tooltip); oldTooltip = tooltip;
private ContextMenu buildContextMenu(Node item) { ContextMenu contextMenu = new ContextMenuWithNoArrows(); CustomMenuItem menuItem = new CustomMenuItem(new Label("Copy subtree test to clipboard...")); Tooltip tooltip = new Tooltip("Creates a node spec using the Kotlin AST matcher DSL, and dumps it to the clipboard"); Tooltip.install(menuItem.getContent(), tooltip); menuItem.setOnAction(e -> { Clipboard clipboard = Clipboard.getSystemClipboard(); ClipboardContent content = new ClipboardContent(); content.putString(dumpToSubtreeTest(item)); // item is captured in the closure clipboard.setContent(content); }); contextMenu.getItems().add(menuItem); return contextMenu; }
viewGlyphDetail(glyph); }); Tooltip.install(button, new Tooltip(glyph.getName())); return button;
Tooltip.install(this, new Tooltip((tooltipStr == null) ? "" : tooltipStr.toUpperCase()));
final Tooltip tooltip = new Tooltip(tooltipText); Tooltip.install(pane, tooltip); menu.getItems().add(item);
Tooltip.install(this, tooltip); oldTooltip = tooltip;
private void setDeleteIcon(final GridPane grid, final Label label, final ImageView imgView, final boolean isYaml) { final Tooltip tooltip = new Tooltip(); tooltip.setText(RESOURCES.getString("delete")); Tooltip.install(imgView, tooltip); grid.getChildren().remove(imgView); grid.add(imgView, 0, 2); imgView.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() { @Override public void handle(final MouseEvent event) { label.setText(""); grid.getChildren().remove(imgView); if (isYaml) { setSwitchBatchSelected(false); } } }); }
if (node.getStyleClass().stream().noneMatch(c -> c.equals("error"))) node.getStyleClass().add("error"); Tooltip.install(node, tooltip);
CirclePopupMenuNode (MenuItem menuItem) { this.menuItem = menuItem; setId(this.getClass().getSimpleName() + "#" + menuNodeIdAtomicLong.incrementAndGet()); // show the graphical part if (menuItem.getGraphic() == null) { throw new NullPointerException("MenuItems in CirclePopupMenu require a graphical part, text is optional"); } getChildren().add(menuItem.getGraphic()); // show the text as a tooltip if (menuItem.getText() != null && menuItem.getText().length() > 0) { Tooltip t = new Tooltip(menuItem.getText()); Tooltip.install(this, t); } // react on a mouse click to perform the menu action setOnMouseClicked( (eventHandler) -> { hide(); if (menuItem.getOnAction() != null) { menuItem.getOnAction().handle(null); } }); } final private MenuItem menuItem;
CornerMenuNode (MenuItem menuItem) { this.menuItem = menuItem; setId(this.getClass().getSimpleName() + "#" + menuNodeIdAtomicLong.incrementAndGet()); // show the graphical part if (menuItem.getGraphic() == null) { throw new NullPointerException("MenuItems in CornerMenu require a graphical part, text is optional"); } getChildren().add(menuItem.getGraphic()); // show the text as a tooltip if (menuItem.getText() != null && menuItem.getText().length() > 0) { Tooltip t = new Tooltip(menuItem.getText()); Tooltip.install(this, t); } // react on a mouse click to perform the menu action setOnMouseClicked( (eventHandler) -> { if (isAutoShowAndHide()) { hide(); } if (menuItem.getOnAction() != null) { menuItem.getOnAction().handle(null); } }); } final private MenuItem menuItem;
/** * Constructs a new map view with an initially empty list of countries which will * result in the entire world to be shown. */ public WorldMapView() { getStyleClass().add(DEFAULT_STYLE_CLASS); setCountryViewFactory(country -> { CountryView view = new CountryView(country); view.setOnMouseEntered(evt -> tooltip.setText(country.getLocale().getDisplayCountry())); Tooltip.install(view, tooltip); return view; }); setLocationViewFactory(location -> { Circle circle = new Circle(); circle.setRadius(4); circle.setTranslateX(-4); circle.setTranslateY(-4); circle.setOnMouseEntered(evt -> tooltip.setText(location.getName())); Tooltip.install(circle, tooltip); return circle; }); }
/** * Creates a region with the miniature of the list element * * @return A region with the miniature of the list element */ private Region createMiniature() { final Region miniature = new Region(); miniature.getStyleClass().add("iconListMiniatureImage"); miniature.styleProperty().bind( Bindings.createStringBinding( () -> String.format("-fx-background-image: url(\"%s\");", getControl().getMiniatureUri().toString()), getControl().miniatureUriProperty())); final Tooltip tooltip = new Tooltip(); tooltip.textProperty().bind(getControl().titleProperty()); Tooltip.install(miniature, tooltip); // set a gray filter for this element if it is not enabled getControl().enabledProperty().addListener((Observable invalidation) -> updateEnabled(miniature)); // adopt the enable status during initialisation updateEnabled(miniature); return miniature; }
public Bar(CalendarNode node, String seriesStyleClass, String dataStyleClass, int depth) { this.node = node; this.depth = depth; this.seriesStyleClass = seriesStyleClass; this.dataStyleClass = dataStyleClass; setAutoSizeChildren(false); bar = new RegionWithTitle(node.getName()); getChildren().addAll(bar); updateStyleClasses(); tooltip = new Tooltip(); tooltip.setGraphic(new TooltipContent()); Tooltip.install(bar, tooltip); setCursor(javafx.scene.Cursor.HAND); initListeners(); }
Tooltip.install(this, new Tooltip((tooltipStr == null) ? "" : tooltipStr.toUpperCase()));
/** * @return menu content containing a list of achievements */ protected final MenuContent createContentAchievements() { log.debug("createContentAchievements()"); MenuContent content = new MenuContent(); for (Achievement a : app.getGameplay().getAchievementManager().getAchievements()) { CheckBox checkBox = new CheckBox(); checkBox.setDisable(true); checkBox.selectedProperty().bind(a.achievedProperty()); Text text = getUIFactory().newText(a.getName()); Tooltip.install(text, new Tooltip(a.getDescription())); HBox box = new HBox(25, text, checkBox); box.setAlignment(Pos.CENTER_RIGHT); content.getChildren().add(box); } return content; }
final Tooltip tooltip = new Tooltip(tooltipText); Tooltip.install(pane, tooltip); menu.getItems().add(item);
Tooltip tooltipVoltageLevel1 = new Tooltip(); tooltipVoltageLevel1.textProperty().bind(this.voltageLevel1); Tooltip.install(voltageLevel1Text, tooltipVoltageLevel1); Tooltip tooltipVoltageLevel2 = new Tooltip(); tooltipVoltageLevel2.textProperty().bind(this.voltageLevel2); Tooltip.install(voltageLevel2Text, tooltipVoltageLevel2);
/** * Refreshes the shown scripts. * When this method is called it begins by clearing the <code>scriptGrid</code>. * Afterwards this method refills it. */ private void updateScripts(final GridPane scriptGrid) { scriptGrid.getChildren().clear(); for (int i = 0; i < filteredScripts.size(); i++) { ScriptDTO script = filteredScripts.get(i); final Label scriptName = new Label(script.getScriptName()); GridPane.setHgrow(scriptName, Priority.ALWAYS); if (getControl().isShowScriptSource()) { final Tooltip tooltip = new Tooltip(tr("Source: {0}", script.getScriptSource())); Tooltip.install(scriptName, tooltip); } final Button installButton = new Button(tr("Install")); installButton.setOnMouseClicked(evt -> { try { installScript(script); } catch (IllegalArgumentException e) { final ErrorDialog errorDialog = ErrorDialog.builder() .withMessage(tr("Error while trying to download the installer")) .withException(e) .build(); errorDialog.showAndWait(); } }); scriptGrid.addRow(i, scriptName, installButton); } }