下面列出了javafx.scene.control.Tooltip#setText ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void nodeValueChanged(final ObservableValue<? extends Number> property, final Number old_value, final Number new_value)
{
if (active)
return;
final Tooltip tip = jfx_node.getTooltip();
if (model_widget.propShowValueTip().getValue())
{
final String text = Objects.toString(new_value);
if (tip != null)
tip.setText(text);
else
jfx_node.setTooltip(new Tooltip(text));
}
else if (tip != null)
jfx_node.setTooltip(null);
toolkit.fireWrite(model_widget, new_value);
}
/**
* This method will update the source control after evaluating the validation condition (see {@link #eval()}).
* <p>
* If the validator isn't "passing" the {@link #PSEUDO_CLASS_ERROR :error} pseudoclass is applied to the
* {@link #srcControl}.
* <p>
* Applies the {@link #PSEUDO_CLASS_ERROR :error} pseudo class and the errorTooltip to
* the {@link #srcControl}.
*/
protected void onEval() {
Node control = getSrcControl();
boolean invalid = hasErrors.get();
control.pseudoClassStateChanged(PSEUDO_CLASS_ERROR, invalid);
Tooltip activeTooltip = getActiveTooltip(control);
if (invalid) {
Tooltip errorTooltip = errorTooltipSupplier.get();
errorTooltip.getStyleClass().add(ERROR_TOOLTIP_STYLE_CLASS);
errorTooltip.setText(getMessage());
install(control, activeTooltip, errorTooltip);
} else {
Tooltip orgTooltip = (Tooltip) control.getProperties().remove(TEMP_TOOLTIP_KEY);
install(control, activeTooltip, orgTooltip);
}
}
public static void updateConfidence(TransactionConfidence confidence,
Tooltip tooltip,
TxConfidenceIndicator txConfidenceIndicator) {
if (confidence != null) {
switch (confidence.getConfidenceType()) {
case UNKNOWN:
tooltip.setText(Res.get("confidence.unknown"));
txConfidenceIndicator.setProgress(0);
break;
case PENDING:
tooltip.setText(Res.get("confidence.seen", confidence.numBroadcastPeers()));
txConfidenceIndicator.setProgress(-1.0);
break;
case BUILDING:
tooltip.setText(Res.get("confidence.confirmed", confidence.getDepthInBlocks()));
txConfidenceIndicator.setProgress(Math.min(1, (double) confidence.getDepthInBlocks() / 6.0));
break;
case DEAD:
tooltip.setText(Res.get("confidence.invalid"));
txConfidenceIndicator.setProgress(0);
break;
}
txConfidenceIndicator.setPrefSize(24, 24);
}
}
@Override
protected void updateItem(ShiftConstraint shiftConstraint, boolean empty) {
super.updateItem(shiftConstraint, empty);
if (shiftConstraint == null || empty) {
setGraphic(null);
return;
}
Glyph result;
Tooltip tooltip = new Tooltip();
switch (shiftConstraint) {
case SHIFTX:
result = new Glyph(FONT_AWESOME, FontAwesome.Glyph.ARROWS_H).size(FONT_SIZE_COMBO);
tooltip.setText("Allow to modify the x value of the points");
setText("shift x");
break;
case SHIFTXY:
result = new Glyph(FONT_AWESOME, FontAwesome.Glyph.ARROWS).size(FONT_SIZE_COMBO);
tooltip.setText("Allow to modify the the points freely");
setText("shift xy");
break;
case SHIFTY:
result = new Glyph(FONT_AWESOME, FontAwesome.Glyph.ARROWS_V).size(FONT_SIZE_COMBO);
tooltip.setText("Allow to modify the x value of the points");
setText("shift y");
break;
default:
result = new Glyph(FONT_AWESOME, FontAwesome.Glyph.QUESTION_CIRCLE).size(FONT_SIZE_COMBO);
setText("-");
}
result.setTextFill(Color.DARKBLUE);
result.setPadding(Insets.EMPTY);
setGraphic(result);
}
private void init() {
this.setCenter(rootVBox);
this.setTitle("登录");
this.setWidth(380);
this.setHeight(600);
this.setRadius(10);
rootVBox.getChildren().add(hBox1);
rootVBox.getChildren().add(hBox2);
rootVBox.getChildren().add(hBox3);
rootVBox.getChildren().add(hBox4);
Tooltip tooltip1 = new Tooltip();
tooltip1.setText("账号");
tooltip1.setHideOnEscape(true);
TextField textField1 = new TextField();
textField1.setTooltip(tooltip1);
Button button1 = new Button();
button1.setText("点击");
button1.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
tooltip1.show(TooltipFrame.this);
}
});
hBox1.getChildren().add(textField1);
hBox1.getChildren().add(button1);
}
public static Tooltip createFrom(String toolTipText) {
if (StringUtils.isBlank(toolTipText)) {
return null;
}
Tooltip tip = new Tooltip();
tip.setText(toolTipText);
tip.setContentDisplay(ContentDisplay.TEXT_ONLY);
return tip;
}
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
loadScenarios();
Tooltip tt = new Tooltip();
tt.setText(facebookURL);
carlfxHyperlink.setTooltip(tt);
carlfxHyperlink.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent evt) {
//webEngine.load(rssFeed.link);
}
});
createColumns(recipeTableView1);
recipeTableView1.setItems(getChapterRecipes("1"));
createLaunchAppEvent(recipeTableView1);
createColumns(recipeTableView2);
recipeTableView2.setItems(getChapterRecipes("2"));
createLaunchAppEvent(recipeTableView2);
/*
createColumns(chap3RecipeTableView);
chap3RecipeTableView.setItems(getChapterRecipes("3"));
createLaunchAppEvent(chap3RecipeTableView);
createColumns(chap4RecipeTableView);
chap4RecipeTableView.setItems(getChapterRecipes("4"));
createLaunchAppEvent(chap4RecipeTableView);
*/
}
private void createToolTip() {
if (node instanceof IliasFile) {
Tooltip tooltip = new Tooltip();
String fileExtension = ((IliasFile) this.node).getExtension();
String fileSizeLabel = ((IliasFile) this.node).getSizeLabel();
tooltip.setText("Elementtyp: " + fileExtension + "\n" + "Größe: " + fileSizeLabel);
this.setTooltip(tooltip);
}
}
private void attachTooltip( Control element, String tooltipText ) {
final Tooltip tooltip = new Tooltip();
tooltip.setText(tooltipText);
element.setTooltip(tooltip);
}