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

REGRESSION: Wrong FontMetrics set when painting custom components in JScrollPane

XMLWordPrintable

    • b32
    • 6
    • b60
    • generic
    • generic

      A component with custom renderer placed in JScrollPane is being passed a Graphics object with incorrectly initialized FontMetrics during scrolling. Standard paints get correct FontMetrics, paints initiated from scrolling operations don't. I'll attach a simple test case that demonstrates the problem. It works correctly on JDK 1.4.2 and 5.0. It fails on Mustang.

      This seems to be the root cause of NetBeans bug #51731:
      http://www.netbeans.org/issues/show_bug.cgi?id=51731

      first time reported against Mustang b13, reliably reproducible since then until b53.

      The same bug was reported against Mustang as #6307484. Closed as 'not reproducible'. I believe that the attached test case points to a Mustang issue.

      ---

      The attached test case shows a JFrame containing a standard JList with a custom cell renderer. Custom font is set to Monospaced, 11pt. The initial paint works ok. The problem occurs when I start to scroll the JList content using the scroll bar. The debug getFontMetrics() dump shows that different FontMetrics are being passed in the "standard" and "scrolling" scenarios.

            svioletsunw Scott Violet (Inactive)
            jchalupa Jan Chalupa
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: