-
Bug
-
Resolution: Fixed
-
P4
-
5.0
-
b14
-
x86
-
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)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
When a custom EditorKit is registered for text/plain, a newly instantiated JEditorPane with text/plain content type ignores the registry and uses the default EditorKit as specified by the UI. This is because JEditorPane.setContentType() only changes the EditorKit if the content types differ, which they never do since the UI always creates a text/plain EditorKit for a JEditorPane.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test source.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Registered: javax.swing.text.DefaultEditorKit
Actual: javax.swing.text.DefaultEditorKit@xxxxxx
ACTUAL -
Registered: javax.swing.text.DefaultEditorKit
Actual: javax.swing.JEditorPane$PlainEditorKit@xxxxxx
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.JEditorPane;
import javax.swing.text.DefaultEditorKit;
public class BugTest
{
public static void main(String[] args)
{
JEditorPane.registerEditorKitForContentType("text/plain", DefaultEditorKit.class.getName());
System.out.println("Registered: " + JEditorPane.getEditorKitClassNameForContentType("text/plain"));
JEditorPane editorPane = new JEditorPane("text/plain", null);
System.out.println("Actual: " + editorPane.getEditorKit());
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Set the JEditorPane content type to something other than text/plain to force registry lookup, e.g. replace:
JEditorPane editorPane = new JEditorPane("text/plain", null);
with:
JEditorPane editorPane = new JEditorPane();
editorPane.setContentType("text/rtf");
editorPane.setContentType("text/plain");
###@###.### 11/3/04 20:43 GMT
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 :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
When a custom EditorKit is registered for text/plain, a newly instantiated JEditorPane with text/plain content type ignores the registry and uses the default EditorKit as specified by the UI. This is because JEditorPane.setContentType() only changes the EditorKit if the content types differ, which they never do since the UI always creates a text/plain EditorKit for a JEditorPane.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test source.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Registered: javax.swing.text.DefaultEditorKit
Actual: javax.swing.text.DefaultEditorKit@xxxxxx
ACTUAL -
Registered: javax.swing.text.DefaultEditorKit
Actual: javax.swing.JEditorPane$PlainEditorKit@xxxxxx
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.JEditorPane;
import javax.swing.text.DefaultEditorKit;
public class BugTest
{
public static void main(String[] args)
{
JEditorPane.registerEditorKitForContentType("text/plain", DefaultEditorKit.class.getName());
System.out.println("Registered: " + JEditorPane.getEditorKitClassNameForContentType("text/plain"));
JEditorPane editorPane = new JEditorPane("text/plain", null);
System.out.println("Actual: " + editorPane.getEditorKit());
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Set the JEditorPane content type to something other than text/plain to force registry lookup, e.g. replace:
JEditorPane editorPane = new JEditorPane("text/plain", null);
with:
JEditorPane editorPane = new JEditorPane();
editorPane.setContentType("text/rtf");
editorPane.setContentType("text/plain");
###@###.### 11/3/04 20:43 GMT
- relates to
-
JDK-6223429 Regression:javax/swing/text/html/StyleSheet/4231331/bug4231331.java test fails on JDS3 machine
-
- Closed
-
-
JDK-6202214 JTextPane throws Exception when trying to siwtch from text/html to text/plain
-
- Resolved
-
-
JDK-6205011 REGRESSION : setPage method in JTextPane throws IllegalArgumentException - Must be StyleEditorKit
-
- Closed
-