Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4225314

BasicToolTipUI assumes border size of JToolTip

XMLWordPrintable

    • beta
    • generic
    • generic



      Name: dbT83986 Date: 03/30/99


      set a border on a JToolTip that has a width/height greater than
       1. as in:
      public JToolTip createToolTip()
      {
        JToolTip tt = new JToolTip();
        tt.setComponent(this);
        tt.setBorder(new LineBorder(Color.black, 5));
        return tt;
      }

      when the JToolTip is displayed on the screen, some of the
      text will be overwritten by the border.

      BasicToolTipUI has in its getPreferredSize() :
              Font font = c.getFont();
              FontMetrics metrics = Toolkit.getDefaultToolkit().getFontMetrics(font);
      // fix for bug 4094153
      String tipText = ((JToolTip)c).getTipText();
      if (tipText == null)
      return new Dimension(6,metrics.getHeight() + 4);
      else
      return new Dimension(metrics.stringWidth(tipText) + 6,
      metrics.getHeight() + 4);

      look at all those "magic" numbers. it really should call
      getInsets().
      (Review ID: 56301)
      ======================================================================

            peterz Peter Zhelezniakov
            dblairsunw Dave Blair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: