Hello.
I would like to make an executable jar file which will contain html files
and be able to
present those files in a JEditorPane that implements a HyperlinkListener.
Can this be done ?
I am struggling with how to obtain the html text from the running jar file.
Thanks in advance.
Roedy Green - 20 Aug 2003 01:46 GMT
>I am struggling with how to obtain the html text from the running jar file.
>Thanks in advance.
You fish them out much the same way you would an Image. See
http://mindprod.com/jgloss/image.html
Rendering the HTML becomes a problem. Swing's html rendering is only
HTML 3.2. See http://mindprod.com/jgloss/htmlrendering.html for your
alternatives.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Brad BARCLAY - 20 Aug 2003 02:56 GMT
> Hello.
> I would like to make an executable jar file which will contain html files
> and be able to
> present those files in a JEditorPane that implements a HyperlinkListener.
> Can this be done ?
> I am struggling with how to obtain the html text from the running jar file.
Take a look at the Class class (java.lang.Class). It has a
getResource() method and a getResourceAsStream() method. The first will
give you a URL object you can use to read the data, and the latter gives
you an instance of InputStream you can use (or wrapper) for data input.
JavaHelp uses this pretty extensively to load HTML files out of JARs,
so if you want to see some sample code of this at work, take a look at
JavaHelp's sources (available through http://java.sun.com).
Brad BARCLAY

Signature
=-=-=-=-=-=-=-=-=
From the OS/2 WARP v4.5 Desktop of Brad BARCLAY.
The jSyncManager Project: http://www.jsyncmanager.org