DevFaqEditorJEPForMimeType

(Difference between revisions)
m (How can I create JEditorPane for a specific document type?)
 
Line 2: Line 2:
===How can I create JEditorPane for a specific document type?===
===How can I create JEditorPane for a specific document type?===
-
You need to find the right <tt>EditorKit</tt> first and then set it on your <tt>JEditorPane</tt>.
+
You need to find the right <tt>EditorKit</tt> first and then set it on your <tt>JEditorPane</tt>. Here is an example showing how to do that for a java file.
-
 
+
-
Here is an example showing how to do that for a java file.
+
<pre>
<pre>
Line 15: Line 13:
--------
--------
-
Applies to: NetBeans 6.0 <br>
+
Applies to: NetBeans 6.x
-
Platforms: All <br>
+
 
 +
Platforms: All
 +
 
See also:
See also:
[http://www.netbeans.org/download/dev/javadoc/org-openide-text/org/openide/text/CloneableEditorSupport.html#getEditorKit(java.lang.String) CloneableEditorSupport.getEditorKit()]
[http://www.netbeans.org/download/dev/javadoc/org-openide-text/org/openide/text/CloneableEditorSupport.html#getEditorKit(java.lang.String) CloneableEditorSupport.getEditorKit()]

Current revision as of 14:06, 16 June 2010

How can I create JEditorPane for a specific document type?

You need to find the right EditorKit first and then set it on your JEditorPane. Here is an example showing how to do that for a java file.

EditorKit kit = CloneableEditorSupport.getEditorKit("text/x-java");

JEditorPane jep = new JEditorPane();
jep.setEditorKit(kit);

Applies to: NetBeans 6.x

Platforms: All

See also: CloneableEditorSupport.getEditorKit()

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo