-
Bug
-
Resolution: Fixed
-
P4
-
5.0, 6
-
b20
-
generic, x86
-
generic, windows_xp
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)
A DESCRIPTION OF THE PROBLEM :
When using the JTextPane and setting the contetnt type to text/html and then back to text/plain using the setContentType(String) method the JVM Throws a java.lang.IllegalArgumentException
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a JTextPane;
2. change the content type to text/html (possibly others as well);
3. change the content type back to text/plain (using the setContentType("text/plain") method).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
the JTextPane should set the content type back to text/plain.
ACTUAL -
An Exception occurs.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.IllegalArgumentException: Must be StyledEditorKit
at javax.swing.JTextPane.setEditorKit(Unknown Source)
at javax.swing.JEditorPane.setContentType(Unknown Source)
at Tester.main(Tester.java:19)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Tester {
public static void main(String[] args) {
javax.swing.JFrame f = new javax.swing.JFrame();
javax.swing.JTextPane pane = new javax.swing.JTextPane();
f.getContentPane().add(pane);
pane.setContentType("text/html");
pane.setText("blabla");
pane.setContentType("text/plain");
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
use
setEditorKit(new StyledEditorKit());
instead of
setContentType("text/plain");
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)
A DESCRIPTION OF THE PROBLEM :
When using the JTextPane and setting the contetnt type to text/html and then back to text/plain using the setContentType(String) method the JVM Throws a java.lang.IllegalArgumentException
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a JTextPane;
2. change the content type to text/html (possibly others as well);
3. change the content type back to text/plain (using the setContentType("text/plain") method).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
the JTextPane should set the content type back to text/plain.
ACTUAL -
An Exception occurs.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.IllegalArgumentException: Must be StyledEditorKit
at javax.swing.JTextPane.setEditorKit(Unknown Source)
at javax.swing.JEditorPane.setContentType(Unknown Source)
at Tester.main(Tester.java:19)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Tester {
public static void main(String[] args) {
javax.swing.JFrame f = new javax.swing.JFrame();
javax.swing.JTextPane pane = new javax.swing.JTextPane();
f.getContentPane().add(pane);
pane.setContentType("text/html");
pane.setText("blabla");
pane.setContentType("text/plain");
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
use
setEditorKit(new StyledEditorKit());
instead of
setContentType("text/plain");
- duplicates
-
JDK-6205011 REGRESSION : setPage method in JTextPane throws IllegalArgumentException - Must be StyleEditorKit
-
- Closed
-
- relates to
-
JDK-6190309 JEditorPane ignores registered EditorKit for text/plain
-
- Resolved
-