JDK-6252157 : Text disappears and reappears with certain fonts in JTextComponents (LINUX)
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2005-04-07
  • Updated: 2010-04-02
  • Resolved: 2005-09-02
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Linux gaz 2.4.18 #18 SMP Mon Feb 24 11:42:05 EST 2003 i686 unknown


A DESCRIPTION OF THE PROBLEM :
Our text components have been experiencing random instances of text that disappears in the window.  The text will appear/disappear as text is selected. The problem seems worse with larger font sizes (the larger the font, the more likely you are to see this bug).  We have seen it with the 1.4.2 VM as well as the 1.5 VM.  We have seen this in a JEditorPane and in a JTextArea.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the code with this report and run it.
Scroll to the bottom of the text area where you see the text "c =".
Select text in the window (esp around the area where you see (or maybe you won't be able to see it) text that says "a: 'a'".
Text will disappear and reappear as you select around in the window.  You do not always have to select text for it to be invisible (bug is not selection dependent, that is just the way to see the bug).

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expect that text will never disappear.
ACTUAL -
Text disappears as you select text in the window and reappears.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.Font;

public class TestTextArea {

    public TestTextArea()
    {
        JFrame frame = new JFrame("Text Area");
        JTextArea textArea = new JTextArea();
        textArea.setLineWrap(false);
        textArea.setText("Warning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\toolbox\\images\\dicom.\n" +
                "Warning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\toolbox\\stw\\dependencies\\hds2.\n" +
                "Warning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\toolbox\\des\\desdemos.\n" +
                "Warning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools.\n" +
                "Warning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\compilertools.\n" +
                "Warning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\autopilot." +
                "\nWarning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\slrtw." +
                "\nWarning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\slrtw\\dastudio." +
                "\nWarning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\etargets." +
                "\nWarning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\testomatic." +
                "\nWarning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\toolbox\\stateflow." +
                "\nWarning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\dsptools." +
                "\nWarning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\hwtools." +
                "\nWarning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\pm." +
                "\nWarning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\stm." +
                "\n" +
                "\n  To get started, select MATLAB Help or Demos from the Help menu." +
                "\n" +
                "\n>> c = struct('a', 'a', 'A12345', 'b', 'c', 'astring')" +
                "\n" +
                "\nc = " +
                "\n" +
                "\n         a: 'a'" +
                "\n    A12345: 'b'" +
                "\n         c: 'astring'" +
                "\n" +
                "\n>> d" +
                "\n??? Undefined function or variable 'd'." +
                "\n" +
                "\n>> d" +
                "\n");
        textArea.getAccessibleContext().setAccessibleName("foo");
        textArea.setDragEnabled(true);
        textArea.setFont(new Font("Monospaced", Font.PLAIN, 60));
        JScrollPane sp = new JScrollPane(textArea);
        frame.getContentPane().add(sp);
        frame.getAccessibleContext().setAccessibleName("the frame");
        frame.setSize(1000,1000);
        frame.setLocation(300,300);
        frame.setVisible(true);

    }

    public static void main(String[] args)
    {
        new TestTextArea();
    }


}
---------- END SOURCE ----------
###@###.### 2005-04-07 18:15:46 GMT

Comments
EVALUATION The submitter has been reproducing this problem on systems with the following config details : > XFree86 Version 4.1.0.1 / X Window System > (II) MGA: driver for Matrox chipsets: mga2064w, mga1064sg, mga2164w, > mga2164w AGP, mgag100, mgag100 PCI, mgag200, mgag200 PCI, mgag400 A test case sent to the submitter reproduced the problem too. So this is definitely the same problem as 5046469. One puzzling piece however is why the submitter isn't seeing a problem with mustang b40 (the only mustang build tried, so not saying that build specifically) A later system with --) Chipset GeForce4 MX 440 with AGP8X found using this driver (II) NV: driver for NVIDIA chipsets: RIVA 128, RIVA TNT, RIVA TNT2, XFree86 Version 4.3.0.1 Release Date: 9 May 2003 did *not* show the problem on any release.
02-09-2005

EVALUATION I suspect this is the same issue as 5046469 : JDK on Linux: doesn't draw a rotated/tall string completely since this is a) Linux, b) using large fonts. I think any string > 32 pixels high could run into this because that's the size we stipple at. It also adds up that drawing to a memory image is fine because the problem is in drawing to an XServer XPixmap. However I can't imagine why it went away in mustang b40 .. this problem still exists. Something about the characteristics of the test case rather than the problem I suppose. One of the problems in understanding the source of this problem has been finding systems which reproduce the problem reliably. So it would be REALLY useful to know the following exact information 1) Linux release name and number and kernel version 2) X server version 3) Video card(s) 4) Extracts from /var/log/XFree86.log or /var/log/Xorg.log which show the video drivers selected and video chip detected.
26-08-2005

EVALUATION I have changed test case to get text component to paint to in memory image (See TestTextArea below). Submitter says the bug is not reproducible with my test case. For me it indicates text component does all the needed text painting but for some reason text does not go through to the screen. -- TestTextArea.java -- import javax.swing.*; import java.awt.Font; import java.awt.Graphics; import java.awt.Rectangle; import java.awt.image.BufferedImage; public class TestTextArea { public static void main(String[] args) { new TestTextArea(); } public TestTextArea() { JFrame frame = new JFrame("Text Area"); JTextArea textArea = new JTextAreaBuffered(); textArea.setLineWrap(false); textArea.setText("Warning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\toolbox\\images\\dicom.\n" + "Warning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\toolbox\\stw\\dependencies\\hds2.\n" + "Warning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\toolbox\\des\\desdemos.\n" + "Warning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools.\n" + "Warning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\compilertools.\n" + "Warning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\autopilot." + "\nWarning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\slrtw." + "\nWarning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\slrtw\\dastudio." + "\nWarning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\etargets." + "\nWarning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\testomatic." + "\nWarning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\toolbox\\stateflow." + "\nWarning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\dsptools." + "\nWarning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\hwtools." + "\nWarning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\pm." + "\nWarning: Name is nonexistent or not a directory: D:\\Work\\Ami\\matlab\\test\\tools\\stm." + "\n" + "\n To get started, select MATLAB Help or Demos from the Help menu." + "\n" + "\n>> c = struct('a', 'a', 'A12345', 'b', 'c', 'astring')" + "\n" + "\nc = " + "\n" + "\n a: 'a'" + "\n A12345: 'b'" + "\n c: 'astring'" + "\n" + "\n>> d" + "\n??? Undefined function or variable 'd'." + "\n" + "\n>> d" + "\n"); textArea.getAccessibleContext().setAccessibleName("foo"); textArea.setDragEnabled(true); textArea.setFont(new Font("Monospaced", Font.PLAIN, 60)); JScrollPane sp = new JScrollPane(textArea); frame.getContentPane().add(sp); frame.getAccessibleContext().setAccessibleName("the frame"); frame.setSize(1000,1000); frame.setLocation(300,300); frame.setVisible(true); } static class JTextAreaBuffered extends JTextArea { @Override protected void paintComponent(Graphics g) { Rectangle clip = g.getClipBounds(); BufferedImage image = new BufferedImage(clip.width, clip.height, BufferedImage.TYPE_INT_RGB); Graphics buffer = image.getGraphics(); buffer.translate(- clip.x, - clip.y); buffer.setClip(clip); super.paintComponent(buffer); g.drawImage(image, clip.x, clip.y, null); } } --- The bug is reproducible on 1.5 but not on 1.6 (they tested on 1.6 b40) Reassigning to java2d for evaluation
26-08-2005

EVALUATION I can not reproduce the bug on my system. Could you provide some more info? 1. What X server are you running 2. Are you running application locally or remotely? 3. If remotely what platform are you running it on and what is local X server? 4. What is your locale 5. If you could attach a screenshot with the problem it would help too. ###@###.### 2005-04-07 19:22:52 GMT
07-04-2005