java redisplay problem on intel driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Could people try the attached Java test program?
There is a bad redisplay problem for large (greater than around 1000
lines) text windows using a TextArea (or a Swing JTextPane).
I have the feeling it is specific to the Intel driver.

To test it, you need to have openjdk "java" installed and
in your path:

$ java -version
java version "1.6.0_0"
IcedTea6 1.4 (fedora-7.b12.fc10-i386) Runtime Environment (build 1.6.0_0-b12)
OpenJDK Server VM (build 10.0-b19, mixed mode)

Java is provided by java-1.6.0-openjdk-1.6.0.0-7.b12.fc10.i386.
However, the same problem occurs with jdk1.6.0 update 11
downloaded directly from Sun, as well as jdk 1.5.0_05.

To test it, put TextTest.java in a temporary directory,
cd to that directory, compile it, and run it:
  $ javac TextTest.java
  $ java TextTest
Now try scrolling back and forth a bit.  What happens for me is that
the text lines will be over-written multiple times on top of each other.

The interesting thing is that only the first 700 lines
or so are garbled - the remaining lines are fine.

My guess is that there is some weird interaction between Java,
the Gtk peers, and the intel driver, since otherwise more people
would have reported this problem. Also, I have tried it on an NVidia-based laptop, and well as with the vesa driver (iirc).
It would be helpful to get some data-points before I decide
whether to complain to Sun or to Intel or to Gnome!
--
	--Per Bothner
per@xxxxxxxxxxx   http://per.bothner.com/
import java.awt.*;
import javax.swing.*;
import javax.swing.text.*;
import java.io.*;

public class TextTest
{
  static String insertFile(Reader in)
    throws Exception
  {
    StringBuffer buf = new StringBuffer();
    int offset = 0;
    char[] buffer = new char[2048];
    for (;;)
      {
        int count = in.read(buffer, 0, buffer.length);
        if (count <= 0)
          break;
        buf.append(buffer, 0, count);
      }
    return buf.toString();
  }

  static String insertFile(String filename)
    throws Exception
  {
    Reader in = new InputStreamReader(new FileInputStream(filename),
                                      "UTF8");
    System.err.println("Inserted file "+filename);
    return insertFile(in);
  }

  static String insertLines(int count)
    throws Exception
  {
    StringBuffer buf = new StringBuffer();
    int offset = 0;
    for (int i = 1;  i <= count;  i++)
      {
        String line = "Line "+i+".\n";
        buf.append(line);
        offset += line.length();
      }
    System.err.println("Inserted "+count+" lines.");
    return buf.toString();
  }

  public static void main(String[] args) throws Throwable
  {
    String data;
    if (args.length == 0)
      data = insertLines(3000);
    else
      {
        try
          {
            data = insertLines(Integer.parseInt(args[0]));
          }
        catch (NumberFormatException ex)
          {
            data = insertFile(args[0]);
          }
      }
    boolean trySwing = false;
    if (! trySwing)
      {
        TextArea text = new TextArea(data, 20, 60,
                                     TextArea.SCROLLBARS_VERTICAL_ONLY);
        Frame frame = new Frame("TextTest");
        frame.add(text);
        frame.pack();
        frame.setVisible(true);
      }
    else
      {
        DefaultStyledDocument doc = new DefaultStyledDocument();
        JFrame frame = new JFrame();
        JTextPane textPane = new JTextPane(doc);
        JScrollPane scrollPane = new JScrollPane(textPane);
        frame.getContentPane().add(scrollPane);
        frame.setSize(600, 500);
        frame.setVisible(true);
        doc.insertString(0, data, null);
      }
  }
}
-- 
fedora-test-list mailing list
fedora-test-list@xxxxxxxxxx
To unsubscribe: 
https://www.redhat.com/mailman/listinfo/fedora-test-list

[Index of Archives]     [Fedora Desktop]     [Fedora SELinux]     [Photo Sharing]     [Yosemite Forum]     [KDE Users]

  Powered by Linux