This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 73627 - cannot set contentType to text/html for jTextPane
Summary: cannot set contentType to text/html for jTextPane
Status: RESOLVED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
: 88501 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-03-16 03:16 UTC by jimkatz
Modified: 2008-01-11 12:54 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jimkatz 2006-03-16 03:16:24 UTC
In GUI mode the jTextPane properties will not allow the contentType to be set to
anything except text/plain. The work around is use the advanced properties to
set it using code: setContentType("text/html"). This bug has been around since 5.0.
Comment 1 Jan Stola 2006-03-27 12:55:03 UTC
When the user attempts to set "text/html" content type then HTMLKit from
html/editor module is set to JTextPane. JTextPane refuses EditorKits
that are not StyledEditorKits. The HTMLKit doesn't extend StyledEditorKit
and therefore it is refused.

org.netbeans.module.editor.html.HTMLKit
  extends org.netbeans.modules.editor.NbEditorKit
  extends org.netbeans.editor.ext.ExtKit
  extends org.netbeans.editor.BaseKit
  extends javax.swing.text.DefaultEditorKit
  ...

java.lang.IllegalArgumentException: Must be StyledEditorKit
  at javax.swing.JTextPane.setEditorKit(Unknown Source)
  at javax.swing.JEditorPane.setContentType(Unknown Source)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  at org.netbeans.modules.form.RADProperty.setTargetValue(RADProperty.java:99)
  ...
Comment 2 Tomas Pavek 2006-11-02 11:49:48 UTC
*** Issue 88501 has been marked as a duplicate of this issue. ***
Comment 3 Tomas Pavek 2007-09-06 14:18:20 UTC
I see no problem with text/html in current NB 6.0, but the same failure appears with text/xml.
We should probably hack the contentType property and not really write to it.
Comment 4 Jan Stola 2008-01-11 12:54:55 UTC
Fixed. It should be possible to enter any value into this property. We ignore possibly thrown IllegalArgumentException
(but we do log it into console).

Modified file:
/cvs/form/src/org/netbeans/modules/form/RADProperty.java
new revision: 1.39; previous revision: 1.38