Java Code Examples for javafx.scene.control.Tooltip#setStyle()

The following examples show how to use javafx.scene.control.Tooltip#setStyle() . 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: LevelOverlay_Controller.java    From Path-of-Leveling with MIT License 6 votes vote down vote up
@Override
public void initialize(URL url, ResourceBundle rb) {
    // TODO
    root.setFocusTraversable(true);
    Tooltip level_t = new Tooltip("Indicates your current level");
    level_t.setStyle("-fx-font-size: 16");
    player.setTooltip(level_t);
    Tooltip zone_t = new Tooltip("Indicates the area monster level");
    zone_t.setStyle("-fx-font-size: 16");
    zone.setTooltip(zone_t);

    Tooltip safe_t = new Tooltip("Your character level must be within this range to get maximum experience");
    safe_t.setStyle("-fx-font-size: 16");
    safezone.setTooltip(safe_t);
    Tooltip xp_t = new Tooltip("The percentage of experience your character is gaining in this area");
    xp_t.setStyle("-fx-font-size: 16");
    xpmulti.setTooltip(xp_t);
}
 
Example 2
Source File: TooltipUtil.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
public static void showTooltipIfTruncated(SkinBase skinBase, Labeled labeled) {
    for (Object node : skinBase.getChildren()) {
        if (node instanceof Text) {
            String displayedText = ((Text) node).getText();
            String untruncatedText = labeled.getText();
            if (displayedText.equals(untruncatedText)) {
                if (labeled.getTooltip() != null) {
                    labeled.setTooltip(null);
                }
            } else if (untruncatedText != null && !untruncatedText.trim().isEmpty()) {
                final Tooltip tooltip = new Tooltip(untruncatedText);

                // Force tooltip to use color, as it takes in some cases the color of the parent label
                // and can't be overridden by class or id
                tooltip.setStyle("-fx-text-fill: -bs-rd-tooltip-truncated;");
                labeled.setTooltip(tooltip);
            }
        }
    }
}