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

The following examples show how to use javafx.scene.control.Tooltip#setGraphic() . 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: ImageViewTableCell.java    From OpenLabeler with Apache License 2.0 6 votes vote down vote up
@Override
protected void updateItem(T item, boolean empty) {
   super.updateItem(item, empty);

   var image = Image.class.cast(item);
   imageView.setImage(image);

   if (image != null) {
      var popupImageView = new ImageView(image);
      popupImageView.setFitHeight(TOOLTIP_SIZE);
      popupImageView.setFitWidth(TOOLTIP_SIZE);
      popupImageView.setPreserveRatio(true);
      Tooltip tooltip = new Tooltip("");
      tooltip.getStyleClass().add("imageTooltip");
      tooltip.setShowDelay(Duration.millis(250));
      tooltip.setGraphic(popupImageView);
      Tooltip.install(this, tooltip);
   }
}
 
Example 2
Source File: HandCard.java    From metastone with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void setCard(GameContext context, Card card, Player player) {
	super.setCard(context, card, player);
	if (tooltipContent == null) {
		tooltip = new Tooltip();
		tooltipContent = new CardTooltip();
		tooltipContent.setCard(context, card, player);
		tooltip.setGraphic(tooltipContent);
		Tooltip.install(this, tooltip);
	} else {
		tooltipContent.setCard(context, card, player);
	}

	hideCard(player.hideCards());

	if (player.hideCards()) {
		Tooltip.uninstall(this, tooltip);
		tooltipContent = null;
		tooltip = null;
	}
}
 
Example 3
Source File: FxmlControl.java    From MyBox with Apache License 2.0 5 votes vote down vote up
public static void setTooltip(final Node node, Node tip) {
    if (node instanceof Control) {
        removeTooltip((Control) node);
    }
    Tooltip tooltip = new Tooltip();
    tooltip.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
    tooltip.setGraphic(tip);
    tooltip.setShowDelay(Duration.millis(10));
    tooltip.setShowDuration(Duration.millis(360000));
    tooltip.setHideDelay(Duration.millis(10));
    Tooltip.install(node, tooltip);
}
 
Example 4
Source File: SummonToken.java    From metastone with GNU General Public License v2.0 5 votes vote down vote up
public SummonToken() {
	super("SummonToken.fxml");
	Tooltip tooltip = new Tooltip();
	cardTooltip = new CardTooltip();
	tooltip.setGraphic(cardTooltip);
	Tooltip.install(this, tooltip);
	frozen.getStrokeDashArray().add(16.0);
}
 
Example 5
Source File: HeroToken.java    From metastone with GNU General Public License v2.0 5 votes vote down vote up
private void updateHeroPower(Hero hero) {
	Image heroPowerImage = new Image(IconFactory.getHeroPowerIconUrl(hero.getHeroPower()));
	heroPowerIcon.setImage(heroPowerImage);
	Card card = CardCatalogue.getCardById(hero.getHeroPower().getCardId());
	Tooltip tooltip = new Tooltip();
	CardTooltip tooltipContent = new CardTooltip();
	tooltipContent.setCard(card);
	tooltip.setGraphic(tooltipContent);
	Tooltip.install(heroPowerIcon, tooltip);
}
 
Example 6
Source File: HeroToken.java    From metastone with GNU General Public License v2.0 5 votes vote down vote up
private void updateWeapon(Weapon weapon) {
	boolean hasWeapon = weapon != null;
	weaponPane.setVisible(hasWeapon);
	if (hasWeapon) {
		weaponNameLabel.setText(weapon.getName());
		setScoreValue(weaponAttackAnchor, weapon.getWeaponDamage(), weapon.getBaseAttack());
		setScoreValue(weaponDurabilityAnchor, weapon.getDurability(), weapon.getBaseDurability(), weapon.getMaxDurability());
		Tooltip tooltip = new Tooltip();
		CardTooltip tooltipContent = new CardTooltip();
		tooltipContent.setCard(weapon.getSourceCard());
		tooltip.setGraphic(tooltipContent);
		Tooltip.install(weaponPane, tooltip);
	}
}
 
Example 7
Source File: Candle.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
Candle(String seriesStyleClass, String dataStyleClass, StringConverter<Number> priceStringConverter) {
    this.seriesStyleClass = seriesStyleClass;
    this.dataStyleClass = dataStyleClass;

    setAutoSizeChildren(false);
    getChildren().addAll(highLowLine, bar);
    getStyleClass().setAll("candlestick-candle", seriesStyleClass, dataStyleClass);
    updateStyleClasses();

    candleTooltip = new CandleTooltip(priceStringConverter);
    Tooltip tooltip = new Tooltip();
    tooltip.setGraphic(candleTooltip);
    Tooltip.install(this, tooltip);
}