Java Code Examples for javafx.scene.control.Tooltip#setShowDelay()
The following examples show how to use
javafx.scene.control.Tooltip#setShowDelay() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageViewTableCell.java From OpenLabeler with Apache License 2.0 | 6 votes |
@Override protected void updateItem(T item, boolean empty) { super.updateItem(item, empty); var image = Image.class.cast(item); imageView.setImage(image); if (image != null) { var popupImageView = new ImageView(image); popupImageView.setFitHeight(TOOLTIP_SIZE); popupImageView.setFitWidth(TOOLTIP_SIZE); popupImageView.setPreserveRatio(true); Tooltip tooltip = new Tooltip(""); tooltip.getStyleClass().add("imageTooltip"); tooltip.setShowDelay(Duration.millis(250)); tooltip.setGraphic(popupImageView); Tooltip.install(this, tooltip); } }
Example 2
Source File: FxmlControl.java From MyBox with Apache License 2.0 | 5 votes |
public static void setTooltip(final Node node, Node tip) { if (node instanceof Control) { removeTooltip((Control) node); } Tooltip tooltip = new Tooltip(); tooltip.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); tooltip.setGraphic(tip); tooltip.setShowDelay(Duration.millis(10)); tooltip.setShowDuration(Duration.millis(360000)); tooltip.setHideDelay(Duration.millis(10)); Tooltip.install(node, tooltip); }
Example 3
Source File: FxmlControl.java From MyBox with Apache License 2.0 | 5 votes |
public static void setTooltip(final Node node, final Tooltip tooltip) { if (node instanceof Control) { removeTooltip((Control) node); } tooltip.setFont(new Font(AppVariables.sceneFontSize)); tooltip.setShowDelay(Duration.millis(10)); tooltip.setShowDuration(Duration.millis(360000)); tooltip.setHideDelay(Duration.millis(10)); Tooltip.install(node, tooltip); }
Example 4
Source File: DataCell.java From phoebus with Eclipse Public License 1.0 | 5 votes |
/** * Constructor. Takes the column index that the cell belongs to. * @param col_idx */ public DataCell(final int col_idx) { this.col_idx = col_idx; tooltip = new Tooltip(); tooltip.setShowDelay(Duration.millis(250)); tooltip.setShowDuration(Duration.seconds(30)); }
Example 5
Source File: Viewer3d.java From phoebus with Eclipse Public License 1.0 | 5 votes |
/** * Install valid comments onto node. * * <p> Valid comments must begin and end with double quotes ("). * * @param node * @param comment * @throws Exception on error. */ private static void installComment(final Node node, final String comment) throws Exception { final String content = checkAndParseComment(comment); final Tooltip tt = new Tooltip(content); tt.setShowDelay(SHOW_QUICKLY); tt.setShowDuration(SHOW_FOREVER); Tooltip.install(node, tt); }
Example 6
Source File: TooltipSupport.java From phoebus with Eclipse Public License 1.0 | 4 votes |
/** Attach tool tip * @param node Node that should have the tool tip * @param tooltip_property Tool tip to show * @param pv_value Supplier of formatted "$(pv_value)". <code>null</code> to use toString of the property. */ public static void attach(final Node node, final WidgetProperty<String> tooltip_property, final Supplier<String> pv_value) { if (disable_tooltips) return; // Patch legacy tool tips that defaulted to pv name & value, // even for static widgets final StringWidgetProperty ttp = (StringWidgetProperty)tooltip_property; if (legacy_tooltip.matcher(ttp.getSpecification()).matches() && ! tooltip_property.getWidget().checkProperty("pv_name").isPresent()) ttp.setSpecification(""); // Suppress tool tip if _initial_ text is empty. // In case a script changes the tool tip at runtime, // tool tip must have some initial non-empty value. // This was done for optimization: // Avoid listener and code to remove/add tooltip at runtime. if (tooltip_property.getValue().isEmpty()) return; final Tooltip tooltip = new Tooltip(); tooltip.setWrapText(true); // Evaluate the macros in tool tip specification each time // the tool tip is about to show tooltip.setOnShowing(event -> { String spec = ((MacroizedWidgetProperty<?>)tooltip_property).getSpecification(); // Use custom supplier for $(pv_value)? // Otherwise replace like other macros, i.e. use toString of the property if (pv_value != null) { final StringBuilder buf = new StringBuilder(); buf.append(pv_value.get()); final Object vtype = tooltip_property.getWidget().getPropertyValue(runtimePropPVValue); final Alarm alarm = Alarm.alarmOf(vtype); if (alarm != null && alarm.getSeverity() != AlarmSeverity.NONE) buf.append(", ").append(alarm.getSeverity()).append(" - ").append(alarm.getName()); final Time time = Time.timeOf(vtype); if (time != null) buf.append(", ").append(TimestampFormats.FULL_FORMAT.format(time.getTimestamp())); spec = spec.replace("$(pv_value)", buf.toString()); } final Widget widget = tooltip_property.getWidget(); final MacroValueProvider macros = widget.getMacrosOrProperties(); String expanded; try { expanded = MacroHandler.replace(macros, spec); if (expanded.length() > Preferences.tooltip_length) expanded = expanded.substring(0, Preferences.tooltip_length) + "..."; tooltip.setText(expanded); } catch (Exception ex) { logger.log(Level.WARNING, "Cannot evaluate tooltip of " + widget, ex); tooltip.setText(spec); } }); // Show after 250 instead of 1000 ms tooltip.setShowDelay(Duration.millis(250)); // Hide after 30 instead of 5 secs tooltip.setShowDuration(Duration.seconds(30)); Tooltip.install(node, tooltip); if (node.getProperties().get(TOOLTIP_PROP_KEY) != tooltip) throw new IllegalStateException("JavaFX Tooltip behavior changed"); }