Date: Wed, 17 Jun 1998 16:33:22 -0500 (CDT) From: Steve Price <sprice@hiwaay.net> To: Sean Kelly <kelly@plutotech.com> Cc: java@FreeBSD.ORG Subject: Re: displaying HTML docs with JEditorPane? Message-ID: <Pine.OSF.3.96.980617162206.22203A-100000@fly.HiWAAY.net> In-Reply-To: <3587DA01.715F6993@plutotech.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Thanks for the response. :) As much as I try I can't seem to get this to work either. :( The relevant code now looks like: import com.sun.java.swing.text.*; import com.sun.java.swing.text.html.*; ... JEditorPane htmlPane = new JEditorPane(); Document doc = HTMLEditorKit.createDefaultDocument(); try { doc.insertString(0, someString, null); } catch (Exception ex) { } htmlPane.setDocument(doc); And when I compile it I see this. javac -classpath .... foo.java:151: Can't make static reference to method com.sun.java.swing.text.document createDefaultDocument() in class com.sun.java.swing.text.html.HTMLEditorKit. Document doc = HTMLEditorKit.createDefaultDocument(); ^ 1 error *** Error code 1 make: Fatal error: Command failed for target `all' I have downloaded an article by Tim Prinzing that I found at the Swing Connection and am reading that right now. I will keep my fingers crossed. Steve On Wed, 17 Jun 1998, Sean Kelly wrote: # # I've never done this, but I'm guessing you need to first create a # Document object that's compatible with HTML. # # java.swing.text.Document doc = # java.swing.text.html.HTMLEditorKit.createDefaultDocument(); # # Then, initialize the doc with the HTML String returned by the server: # # doc.insertString(0, stringFromServer, null); # # Finally, you can use the setDocument method of the JEditorPane (actually # inherited from JTextComponent): # # editorPane.setDocument(doc); # # Good luck. # --k # To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.OSF.3.96.980617162206.22203A-100000>