本文整理了Java中javafx.scene.control.Tooltip.setText()
方法的一些代码示例,展示了Tooltip.setText()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tooltip.setText()
方法的具体详情如下:
包路径:javafx.scene.control.Tooltip
类名称:Tooltip
方法名:setText
暂无
代码示例来源:origin: speedment/speedment
fieldName.getTooltip().setText(item.getDbmsNameMeaning());
代码示例来源: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: 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: 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);
});
}
代码示例来源: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: 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: io.github.factoryfx/javafxDataEditing
tooltip.setText(validationErrorText.toString());
tooltip.setShowDelay(Duration.ZERO);
tooltip.setAnchorLocation(PopupWindow.AnchorLocation.CONTENT_BOTTOM_LEFT);
代码示例来源:origin: torakiki/pdfsam
public TooltippedTextFieldTableCell(String tooltipMessage) {
requireNotBlank(tooltipMessage, "Tooltiped cell must have a tooltip message");
this.tooltip.setText(tooltipMessage);
代码示例来源:origin: com.bitplan.gui/com.bitplan.javafx
tooltip.setText(field.getHint());
control.setTooltip(tooltip);
代码示例来源: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: org.drombler.fx/drombler-fx-core-docking
public static void configureDockableDataFromExistingDocument(FXDockableData dockableData, DataHandler<?> dataHandler) { // TODO: rename
dockableData.setTitle(dataHandler.getTitle());
dataHandler.addPropertyChangeListener(DataHandler.TITLE_PROPERTY_NAME, evt -> dockableData.setTitle(dataHandler.getTitle()));
String tooltipText = dataHandler.getTooltipText();
Tooltip tooltip = createTooltip(dockableData, tooltipText);
dataHandler.addPropertyChangeListener(DataHandler.TOOLTIP_TEXT_PROPERTY_NAME, evt -> tooltip.setText(dataHandler.getTooltipText()));
}
代码示例来源:origin: com.intuit.karate/karate-core
@Override
public void updateItem(ScenarioExecutionUnit item, boolean empty) {
super.updateItem(item, empty);
if (empty) {
return;
}
setText(item.scenario.getDisplayMeta() + " " + item.scenario.getName());
tooltip.setText(item.scenario.getName());
setTooltip(tooltip);
if (item.result.isFailed()) {
setStyle(STYLE_FAIL);
} else if (!item.result.getStepResults().isEmpty()) {
setStyle(STYLE_PASS);
} else {
setStyle("");
}
}
代码示例来源: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: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls
private static void updatePseudoState(Label statusIcon, Status status) {
statusIcon.pseudoClassStateChanged(error, status.getState() == State.ERROR);
statusIcon.pseudoClassStateChanged(warning, status.getState() == State.WARNING);
statusIcon.pseudoClassStateChanged(ok, status.getState() == State.OK);
statusIcon.pseudoClassStateChanged(cancel, status.getState() == State.CANCEL);
statusIcon.autosize();
if( statusIcon.getTooltip() == null ) {
if( status.getState() != State.OK ) {
statusIcon.setTooltip(new Tooltip(status.getMessage()));
}
} else {
statusIcon.getTooltip().setText(status.getMessage());
}
}
代码示例来源:origin: com.jfoenix/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);
}
}
内容来源于网络,如有侵权,请联系作者删除!