-
Bug
-
Resolution: Fixed
-
P2
-
1.2.0
-
1.2fcs
-
sparc
-
solaris_2.6
-
Verified
Name: akC57697 Date: 12/04/97
The java.awt.swing.JTextPane.replaceSelection(s) does not work properly
with full selection.
--------------8-<-------------------------------
import java.awt.swing.JTextPane;
import java.awt.swing.text.*;
public class JTextPaneBug {
public static void main(String s[]) {
String s1="123456789";
JTextPane c = new JTextPane();
c.setText(s1); // Set the string.
c.selectAll(); // Replace with
c.replaceSelection(s1);// same string.
System.exit(0);
}
}
------------->-8--------------------------------
Output:
(novo35 97): java JTextPaneBug
java.lang.NullPointerException
at java.awt.swing.text.DefaultStyledDocument$ElementBuffer.open(DefaultStyledDocument.java:1238)
at java.awt.swing.text.DefaultStyledDocument$ElementBuffer.insertUpdate(DefaultStyledDocument.java:798)
at java.awt.swing.text.DefaultStyledDocument$ElementBuffer.insert(DefaultStyledDocument.java:750)
at java.awt.swing.text.DefaultStyledDocument.insertUpdate(DefaultStyledDocument.java:392)
at java.awt.swing.text.AbstractDocument.insertString(AbstractDocument.java:243)
at java.awt.swing.JTextPane.replaceSelection(JTextPane.java:157)
at JTextPaneBug.main(JTextPaneBug.java:11)
======================================================================