@NotNull
  @Override
  public String calcShownText(@NotNull String text, @NotNull FontMetrics metrics, int maxWidth, @NotNull Graphics g) {
    int width = getStringWidth(text, g, metrics);
    if (width <= maxWidth) return text;

    while (width > maxWidth && text.length() > MIN_TEXT_LENGTH) {
      text = text.substring(0, text.length() - 1);
      width = getStringWidth(text + "...", g, metrics);
    }
    return text + "...";
  }
@NotNull
  @Override
  public String calcShownText(@NotNull String text, @NotNull FontMetrics metrics, int maxWidth, @NotNull Graphics g)