本文整理汇总了Java中javafx.scene.control.Tooltip类的典型用法代码示例。如果您正苦于以下问题:Java Tooltip类的具体用法?Java Tooltip怎么用?Java Tooltip使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Tooltip类属于javafx.scene.control包,在下文中一共展示了Tooltip类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import javafx.scene.control.Tooltip; //导入依赖的package包/类
@FXML
public void initialize() {
lblUserFullName.setText(userFullName()+" ");
showAllMonths();
showAllFilter();
datePicker.setConverter(formatManager);
datePicker.setValue(date);
webEngine = webview.getEngine();
showHisoty();
btnSignOut.setTooltip(new Tooltip("Sign Out from application"));
btnGo.setTooltip(new Tooltip("Seach history by the selected date"));
Tooltip.install(lblUserFullName, new Tooltip("User's Full Name"));
Tooltip.install(cmboHistoryMonth, new Tooltip("Your all transactional month name"));
Tooltip.install(cmboFilterList, new Tooltip("Select a filter to get specilazid search"));
Tooltip.install(datePicker, new Tooltip("Select a date to get history on that day"));
Tooltip.install(webview, new Tooltip("Your History"));
}
示例2: addMenuItem
import javafx.scene.control.Tooltip; //导入依赖的package包/类
@Override
public void addMenuItem(LayoutContext.LayoutMenuItem layoutMenuItem) {
Image image = new Image(getClass().getResourceAsStream("/" + layoutMenuItem.icon() + ".png"));
Button item = new Button("", new ImageView(image));
item.setTooltip(new Tooltip(layoutMenuItem.text()));
item.setCursor(Cursor.HAND);
item.setBackground(Background.EMPTY);
item.setMinWidth(menu.getMinWidth());
item.setOnAction(event -> layoutMenuItem.selectHandler().onSelect());
menu.getChildren().add(item);
}
示例3: initialize
import javafx.scene.control.Tooltip; //导入依赖的package包/类
@FXML
public void initialize() {
loadSQuestion();
btnCancel.setTooltip(new Tooltip("Cancel the registration process and take you to Sign In Window"));
btnRegistration.setTooltip(new Tooltip("If all data typed correctly, \n"
+ "then you will register as a new user"));
Tooltip.install(txtName, new Tooltip("Write your full name"));
Tooltip.install(txtUsername, new Tooltip("Give a username, this will use at the time of login\n"
+ "This should not contain space"));
Tooltip.install(passPassword, new Tooltip("Give a password, this should not contain space"));
Tooltip.install(passReTypePassword, new Tooltip("Retype the password"));
Tooltip.install(cmboSecurityQuestion, new Tooltip("Choose a security question"));
Tooltip.install(txtAnswer, new Tooltip("Answer your question. Remember this answer.\n"
+ "If you forget your password, this will \n"
+ "help you to recover your account."));
}
示例4: initialize
import javafx.scene.control.Tooltip; //导入依赖的package包/类
@FXML
public void initialize() {
lblUserFullName.setText(userFullName()+" "); //show user full name on Menu
lblWalletBalance.setText(addThousandSeparator(getWalletBalance())); //show current wallet balance
CashCalculate(); //set all field initialize value to 0
// add tooltip on mouse hover
btnDashboard.setTooltip(new Tooltip("Will Take you to Dashboard"));
btnMakeATransaction.setTooltip(new Tooltip("Will Take you to Expense"));
btnSignOut.setTooltip(new Tooltip("Sign Out from Application"));
Tooltip.install(lblWalletBalance, new Tooltip("Your wallet balance now"));
Tooltip.install(lblUserFullName, new Tooltip("User's Full Name"));
Tooltip.install(txt1000, new Tooltip("Number of 1000 Tk. Notes in your hand"));
Tooltip.install(txt500, new Tooltip("Number of 500 Tk. Notes in your hand"));
Tooltip.install(txt100, new Tooltip("Number of 100 Tk. Notes in your hand"));
Tooltip.install(txt50, new Tooltip("Number of 50 Tk. Notes in your hand"));
Tooltip.install(txt20, new Tooltip("Number of 20 Tk. Notes in your hand"));
Tooltip.install(txt10, new Tooltip("Number of 10 Tk. Notes in your hand"));
Tooltip.install(txt5, new Tooltip("Number of 5 Tk. Notes in your hand"));
Tooltip.install(txt2, new Tooltip("Number of 2 Tk. Notes in your hand"));
Tooltip.install(txt1, new Tooltip("Number of 1 Tk. Notes in your hand"));
}
示例5: SquidRatioButton
import javafx.scene.control.Tooltip; //导入依赖的package包/类
public SquidRatioButton(int row, int col, String ratioName, boolean selected) {
super(selected ? ratioName : "");
Tooltip ratioToolTip = new Tooltip(ratioName);
setTooltip(ratioToolTip);
setOnAction(new SquidRatioButtonEventHandler(row, col, ratioName, selected));
setPrefWidth(BUTTON_WIDTH - 2);
setPrefHeight(BUTTON_HEIGHT - 2);
setStyle("-fx-padding: 0 0 0 0; \n"
+ " -fx-border-width: 1;\n"
+ " -fx-border-color: black;\n"
+ " -fx-background-radius: 0;\n"
+ " -fx-background-color: #00BFFF;\n"
+ " -fx-font-family: \"Courier New\", \"Lucida Sans\", \"Segoe UI\", Helvetica, Arial, sans-serif;\n"
+ " -fx-font-weight: bold;\n"
+ " -fx-font-size: 8pt;\n"
+ " -fx-text-fill: White;/* #d8d8d8;*/\n"
);
setWrapText(true);
}
示例6: SquidRowColButton
import javafx.scene.control.Tooltip; //导入依赖的package包/类
public SquidRowColButton(int row, int col, String ratioName) {
super(ratioName);
ratioToolTip = new Tooltip("Click to select entire " + (String) (row == -1 ? "column" : "row"));
setTooltip(ratioToolTip);
setOnAction(new SquidRowColButtonEventHandler(row, col));
setPrefWidth(BUTTON_WIDTH - 2);
setPrefHeight(BUTTON_HEIGHT - 2);
setStyle("-fx-padding: 0 0 0 0; \n"
+ " -fx-border-width: 1;\n"
+ " -fx-border-color: black;\n"
+ " -fx-background-radius: 0;\n"
+ " -fx-background-color: #ffa06d;\n"
+ " -fx-font-family: \"Courier New\", \"Lucida Sans\", \"Segoe UI\", Helvetica, Arial, sans-serif;\n"
+ " -fx-font-weight: bold;\n"
+ " -fx-font-size: 9pt;\n"
+ " -fx-text-fill: Black;/* #d8d8d8;*/\n"
);
setWrapText(true);
}
示例7: initGraphics
import javafx.scene.control.Tooltip; //导入依赖的package包/类
private void initGraphics() {
if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
Double.compare(getHeight(), 0.0) <= 0) {
if (getPrefWidth() > 0 && getPrefHeight() > 0) {
setPrefSize(getPrefWidth(), getPrefHeight());
} else {
setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
canvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
ctx = canvas.getGraphicsContext2D();
tooltip = new Tooltip();
tooltip.setAutoHide(true);
getChildren().setAll(canvas);
}
示例8: addRefreshRateBox
import javafx.scene.control.Tooltip; //导入依赖的package包/类
private void addRefreshRateBox(int col, int row) {
HBox viewRefreshRateBox = new HBox();
viewRefreshRateBox.setAlignment(CENTER);
this.viewRefreshRateLabel.setTextFill(this.textColor);
this.viewRefreshRateLabel.setAlignment(CENTER);
this.viewRefreshRateField.setPrefSize(25, 15);
viewRefreshRateBox.getChildren().addAll(
this.viewRefreshRateLabel,
this.viewRefreshRateField
);
this.viewRefreshRateField.setOnAction(e ->
Settings.setViewRefreshRate(Integer.parseInt(this.viewRefreshRateField.getText()))
);
this.viewRefreshRateField.setTooltip(new Tooltip(dict.SETTINGS_VIEW_REFRESH_RATE_FIELD_TOOLTIP));
this.viewRefreshRateLabel.setTooltip(new Tooltip(dict.SETTINGS_VIEW_REFRESH_RATE_LABEL_TOOLTIP));
this.grid.add(viewRefreshRateBox, col,row);
}
示例9: EditorExtAbbreviationItem
import javafx.scene.control.Tooltip; //导入依赖的package包/类
public EditorExtAbbreviationItem(Dictionary dictionary, MarkdownParser markdownParser, TabFactory tabFactory, boolean defaultValue) {
super(dictionary.TOOLBAR_EDITOR_EXTENSIONS_ABBREVIATION_ITEM);
abbreviationExtension = AbbreviationExtension.create();
setSelected(defaultValue);
if(defaultValue)
markdownParser.addExtension(abbreviationExtension);
setToolTip(new Tooltip(dictionary.TOOLBAR_EDITOR_EXTENSIONS_ABBREVIATION_TOOLTIP));
setOnAction(event -> getClickAction(markdownParser, tabFactory));
}
示例10: showTooltip
import javafx.scene.control.Tooltip; //导入依赖的package包/类
public void showTooltip(boolean beginning) {
generateTooltip();
Tooltip tt = requireNonNull(fTooltip);
/*
* Show the tooltip first, then move it to the correct location. It
* needs to be shown for its getWidth() etc. to be populated.
*/
tt.show(this, 0, 0);
Point2D position;
if (beginning) {
/* Align to the bottom-left of the rectangle, left-aligned. */
/* Yes, it needs to be getX() here (0), not getLayoutX(). */
position = this.localToScreen(getX(), getY() + getHeight());
} else {
/* Align to the bottom-right of the rectangle, right-aligned */
position = this.localToScreen(getX() + getWidth() - tt.getWidth(), getY() + getHeight());
}
tt.setAnchorX(position.getX());
tt.setAnchorY(position.getY());
}
示例11: addLocation
import javafx.scene.control.Tooltip; //导入依赖的package包/类
public void addLocation(final Location LOCATION) {
double x = (LOCATION.getLongitude() + 180) * (PREFERRED_WIDTH / 360) + MAP_OFFSET_X;
double y = (PREFERRED_HEIGHT / 2) - (PREFERRED_WIDTH * (Math.log(Math.tan((Math.PI / 4) + (Math.toRadians(LOCATION.getLatitude()) / 2)))) / (2 * Math.PI)) + MAP_OFFSET_Y;
Circle locationIcon = new Circle(x, y, size * 0.01);
locationIcon.setFill(null == LOCATION.getColor() ? getLocationColor() : LOCATION.getColor());
StringBuilder tooltipBuilder = new StringBuilder();
if (!LOCATION.getName().isEmpty()) tooltipBuilder.append(LOCATION.getName());
if (!LOCATION.getInfo().isEmpty()) tooltipBuilder.append("\n").append(LOCATION.getInfo());
String tooltipText = tooltipBuilder.toString();
if (!tooltipText.isEmpty()) {
Tooltip tooltip = new Tooltip(tooltipText);
tooltip.setFont(Font.font(10));
Tooltip.install(locationIcon, tooltip);
}
if (null != LOCATION.getMouseEnterHandler()) locationIcon.setOnMouseEntered(new WeakEventHandler<>(LOCATION.getMouseEnterHandler()));
if (null != LOCATION.getMousePressHandler()) locationIcon.setOnMousePressed(new WeakEventHandler<>(LOCATION.getMousePressHandler()));
if (null != LOCATION.getMouseReleaseHandler()) locationIcon.setOnMouseReleased(new WeakEventHandler<>(LOCATION.getMouseReleaseHandler()));
if (null != LOCATION.getMouseExitHandler()) locationIcon.setOnMouseExited(new WeakEventHandler<>(LOCATION.getMouseExitHandler()));
locations.put(LOCATION, locationIcon);
}
示例12: _initButtonBase
import javafx.scene.control.Tooltip; //导入依赖的package包/类
public static ButtonBase _initButtonBase(String name, String toolTip, boolean enabled, String buttonText, ButtonBase button) {
button.setId(name + "Button");
button.setTooltip(new Tooltip(toolTip));
Node enabledIcon = getImageFrom(name, "icons/", FromOptions.NULL_IF_NOT_EXISTS);
if (enabledIcon != null) {
button.setText(null);
button.setGraphic(enabledIcon);
}
if (buttonText != null) {
button.setText(buttonText);
} else if (enabledIcon == null) {
button.setText(name);
}
button.setDisable(!enabled);
button.setMinWidth(Region.USE_PREF_SIZE);
return button;
}
示例13: updateItem
import javafx.scene.control.Tooltip; //导入依赖的package包/类
@Override public void updateItem(Resource item, boolean empty) {
super.updateItem(item, empty);
if (empty) {
setText(null);
setGraphic(null);
} else {
if (isEditing()) {
if (textField != null) {
textField.setText(getString());
}
setText(null);
setGraphic(textField);
} else {
setText(getString());
setGraphic(getTreeItem().getGraphic());
String d = getTreeItem().getValue().getDescription();
if (d != null) {
setTooltip(new Tooltip(d));
}
}
}
}
示例14: addState
import javafx.scene.control.Tooltip; //导入依赖的package包/类
private void addState(State<?,?> state, HBox line, Color color, int stateIndex, String stateDescription) {
final Rectangle rectangle = new Rectangle(WIDTH, WIDTH, color);
rectangle.setArcHeight(WIDTH);
rectangle.setArcWidth(WIDTH);
rectangle.setUserData(state);
Label text = new Label(computeStateLabel(stateIndex));
text.setTextOverrun(OverrunStyle.ELLIPSIS);
text.setAlignment(Pos.CENTER);
text.setMouseTransparent(true);
text.setTextFill(Color.WHITE);
text.setFont(STATE_FONT);
text.setMaxWidth(WIDTH);
final Tooltip tooltip = new Tooltip(stateDescription);
Tooltip.install(rectangle, tooltip);
StackPane layout = new StackPane();
StackPane.setMargin(rectangle, MARGIN_INSETS);
layout.getChildren().addAll(rectangle, text);
line.getChildren().add(layout);
}
示例15: HelpTooltip
import javafx.scene.control.Tooltip; //导入依赖的package包/类
public HelpTooltip(String tooltipText) {
// Set text as question mark and general style
this.setText("?");
this.setPrefSize(35, 35);
this.setMinSize(35, 35);
this.setFont(Font.font("System", FontWeight.BOLD, 20));
this.setAlignment(Pos.CENTER);
this.setStyle("-fx-background-color: #9098ff; -fx-background-radius: 30px");
// Create and add tooltip (need to set its font because otherwise it's inherited from the Label)
Tooltip descriptionTooltip = new Tooltip(tooltipText);
descriptionTooltip.setPrefWidth(250);
descriptionTooltip.setWrapText(true);
descriptionTooltip.setFont(new Font("System", 12));
this.setTooltip(descriptionTooltip);
}