本文整理了Java中javafx.scene.control.Tooltip
类的一些代码示例,展示了Tooltip
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tooltip
类的具体详情如下:
包路径:javafx.scene.control.Tooltip
类名称:Tooltip
暂无
代码示例来源:origin: speedment/speedment
@Override
public Node createLabel() {
final Label l = new Label(label);
l.setTooltip( new Tooltip(tooltip) );
return l;
}
代码示例来源:origin: pmd/pmd
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);
}
代码示例来源:origin: speedment/speedment
fieldName.getTooltip().setText(item.getDbmsNameMeaning());
代码示例来源:origin: jfoenixadmin/JFoenix
public ValidatorBase() {
parentProperty().addListener((o, oldVal, newVal) -> parentChanged());
errorTooltip = new Tooltip();
errorTooltip.getStyleClass().add("error-tooltip");
}
代码示例来源:origin: jfoenixadmin/JFoenix
/**
* this method will update the source control after evaluating the validation condition
*/
protected void onEval() {
Node control = getSrcControl();
if (hasErrors.get()) {
control.pseudoClassStateChanged(PSEUDO_CLASS_ERROR, true);
if (control instanceof Control) {
Tooltip controlTooltip = ((Control) control).getTooltip();
if (controlTooltip != null && !controlTooltip.getStyleClass().contains("error-tooltip")) {
tooltip = ((Control) control).getTooltip();
}
errorTooltip.setText(getMessage());
((Control) control).setTooltip(errorTooltip);
}
} else {
if (control instanceof Control) {
Tooltip controlTooltip = ((Control) control).getTooltip();
if ((controlTooltip != null && controlTooltip.getStyleClass().contains("error-tooltip"))
|| (controlTooltip == null && tooltip != null)) {
((Control) control).setTooltip(tooltip);
}
tooltip = null;
}
control.pseudoClassStateChanged(PSEUDO_CLASS_ERROR, false);
}
}
代码示例来源:origin: com.bitplan.gui/com.bitplan.javafx
/**
* set the toolTip
*
* @param toolTip
*/
public void setToolTip(String toolTip) {
if (control.getTooltip() == null)
control.setTooltip(new Tooltip());
control.getTooltip().setText(toolTip);
}
代码示例来源:origin: io.github.factoryfx/javafxDataEditing
tooltip = new Tooltip();
tooltip.setText(validationErrorText.toString());
tooltip.setShowDelay(Duration.ZERO);
tooltip.setAnchorLocation(PopupWindow.AnchorLocation.CONTENT_BOTTOM_LEFT);
tooltip.getStyleClass().add("errorTooltip");
if (node.getStyleClass().stream().noneMatch(c -> c.equals("error"))) node.getStyleClass().add("error");
Tooltip.install(node, tooltip);
node.setOnMouseEntered(null);
node.setOnMouseExited(null);
Tooltip.uninstall(node, tooltip);
代码示例来源:origin: speedment/speedment
final ContextMenu menu = new ContextMenu();
final MenuItem item = new MenuItem("Enable editing");
final Tooltip tooltip = new Tooltip(tooltipText);
Tooltip.install(pane, tooltip);
menu.getItems().add(item);
};
final EventHandler<ActionEvent> menuItemClicked = (ActionEvent event) -> {
Tooltip.uninstall(pane, tooltip);
pane.removeEventHandler(MouseEvent.MOUSE_PRESSED, contextMenuToggle);
node.setDisable(false);
代码示例来源:origin: PhoenicisOrg/phoenicis
/**
* 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;
}
代码示例来源:origin: it.unibo.alchemist/alchemist-projectview
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);
}
}
});
}
代码示例来源:origin: torakiki/pdfsam
private ErrorTooltipManager(String message) {
require(isNotBlank(message), "Tooltip message cannot be blank");
this.tooltip = new Tooltip(message);
this.tooltip.getStyleClass().add(ERROR_TOOLTIP_CLASS);
hideTimer.getKeyFrames().add(new KeyFrame(new Duration(5000)));
hideTimer.setOnFinished(e -> {
tooltip.hide();
ErrorTooltipManager.this.active = false;
});
activationTimer.getKeyFrames().add(new KeyFrame(new Duration(250)));
activationTimer.setOnFinished(e -> {
if (!ErrorTooltipManager.this.active) {
Scene scene = getScene();
if (scene != null) {
Window owner = scene.getWindow();
if (owner != null && owner.isShowing() && ValidableTextField.this.isVisible()) {
Point2D where = getDisplayCoordiantes(owner, scene);
tooltip.show(ValidableTextField.this, where.getX(), where.getY());
ErrorTooltipManager.this.active = true;
hideTimer.playFromStart();
}
}
}
});
}
代码示例来源:origin: org.drombler.fx/drombler-fx-core-docking
private static Tooltip createTooltip(FXDockableData dockableData, final String tooltipText) {
Tooltip tooltip = dockableData.getTooltip();
if (tooltip == null) {
tooltip = new Tooltip(tooltipText);
tooltip.setTextOverrun(OverrunStyle.CENTER_WORD_ELLIPSIS);
dockableData.setTooltip(tooltip);
} else {
tooltip.setText(tooltipText);
}
return tooltip;
}
代码示例来源:origin: nl.cloudfarming.client/calendar-api
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();
}
代码示例来源:origin: org.controlsfx/controlsfx
protected Tooltip createTooltip(ValidationMessage message) {
Tooltip tooltip = new Tooltip(message.getText());
tooltip.setOpacity(.9);
tooltip.setAutoFix(true);
tooltip.setStyle( Severity.ERROR == message.getSeverity()? ERROR_TOOLTIP_EFFECT: WARNING_TOOLTIP_EFFECT);
return tooltip;
}
代码示例来源:origin: org.controlsfx/controlsfx
private Tooltip tooltip = new Tooltip();
private StringBinding textBinding = new When(action.longTextProperty().isEmpty()).then(action.textProperty()).otherwise(action.longTextProperty());
tooltip.textProperty().bind(textBinding);
代码示例来源:origin: org.controlsfx/controlsfx
/**
* 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;
});
}
代码示例来源:origin: jfoenixadmin/JFoenix
Tooltip.uninstall(this, oldTooltip);
Tooltip.install(this, tooltip);
oldTooltip = tooltip;
代码示例来源:origin: com.dlsc.formsfx/formsfx-core
/**
* Sets the error message as tooltip for the matching control.
*
* @param below
* The control needed for positioning the tooltip.
* @param reference
* The control which gets the tooltip.
*/
protected void toggleTooltip(Node reference, Control below) {
String fieldTooltip = field.getTooltip();
if ((reference.isFocused() || reference.isHover()) && (!fieldTooltip.equals("") || field.getErrorMessages().size() > 0)) {
tooltip.setText((!fieldTooltip.equals("") ? fieldTooltip + "\n" : "") + String.join("\n", field.getErrorMessages()));
if (tooltip.isShowing()) {
return;
}
Point2D p = below.localToScene(0.0, 0.0);
tooltip.show(
getScene().getWindow(),
p.getX() + getScene().getX() + getScene().getWindow().getX(),
p.getY() + getScene().getY() + getScene().getWindow().getY() + below.getHeight() + 5
);
} else {
tooltip.hide();
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
Tooltip.install(this, tooltip);
oldTooltip = tooltip;
代码示例来源:origin: org.codehaus.griffon/griffon-javafx
public static void setTooltip(@Nonnull Control control, @Nullable String text) {
runInsideUIThread(() -> {
if (isBlank(text)) {
return;
}
requireNonNull(control, ERROR_CONTROL_NULL);
Tooltip tooltip = control.tooltipProperty().get();
if (tooltip == null) {
tooltip = new Tooltip();
control.tooltipProperty().set(tooltip);
}
tooltip.setText(text);
});
}
内容来源于网络,如有侵权,请联系作者删除!