private void addRatingListenerToTooltip(FloatProperty ratingProperty, Tooltip tooltip) { ratingProperty.addListener( (observable, oldValue, newValue) -> { String updatedRating = i18n.get( "userInfo.ratingFormat", RatingUtil.getGlobalRating(playerInfoBean), RatingUtil.getLeaderboardRating(playerInfoBean)); tooltip.setText(updatedRating); }); }
private void configureRatingTooltip() { if (!playerInfoBean.getChatOnly()) { Tooltip userRatingTooltip = new Tooltip(); String rating = i18n.get( "userInfo.ratingFormat", RatingUtil.getRoundedGlobalRating(playerInfoBean), RatingUtil.getLeaderboardRating(playerInfoBean)); userRatingTooltip.setText(rating); addRatingListenerToTooltip(playerInfoBean.leaderboardRatingMeanProperty(), userRatingTooltip); addRatingListenerToTooltip(playerInfoBean.globalRatingMeanProperty(), userRatingTooltip); Tooltip.install(clanLabel, userRatingTooltip); Tooltip.install(usernameLabel, userRatingTooltip); } }