@Override
  public Dimension getPreferredSize(JComponent c) {
    FontMetrics metrics = c.getFontMetrics(c.getFont());
    @NlsContexts.Tooltip String tipText = ((JToolTip)c).getTipText();
    if (tipText == null) {
      tipText = "";
    }
    int maxWidth = 0;
    myLines.clear();

    @Nls String[] lines = LineTokenizer.tokenize(tipText.toCharArray(), false);
    for (@Nls String line : lines) {
      myLines.add(line);
      int width = SwingUtilities.computeStringWidth(metrics, line);
      if (width > maxWidth) {
        maxWidth = width;
      }
    }

    int height = metrics.getHeight() * Math.max(lines.length, 1);
    return new Dimension(maxWidth + 6, height + 4);
  }
@Override
  public Dimension getPreferredSize(JComponent c)