🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #10082

Re: Using JEditorPane to Display a Local HTML file

#10082
From: Joe Mayo
Date: Tue, 16 Nov 1999 00:00
37 lines
2012 bytes
Try something like this:

String myUrl = "file:" + "help" + System.getProperty("file.separator") +
"helpFile.htm";

Note:  You may need to put a file separator or even more path info in front
of the "help" directory.

try {
   JEditorPane.setPage(myUrl);
}
catch (MalformedURLException e) {
   e.printStackTrace();
   System.out.println("Bad URL: " + myUrl);
}

--
Joe Mayo

Arun Horne <cs98abh@cs98abh.fsnet.co.uk> wrote in message
news:80q9dc$pno$1@news7.svr.pol.co.uk...
> Hi
>
> I need to use the Java Swing JEditorPane to display an HTML file that is
> stored in the ./help/helpFile.htm direcotry. Ie. in a subdirectory below
> where my source code is held. I have done the following:
>
> JEditorPane.setEditable(false);
> JEditorPane.setPage("help/helpFile.htm");
>
> However I get MalformedURLExceptions from this. Should I specifiy a
> protocol? If so how?
>
> Thanks in advance
> Arun Horne (arun@aznet.freeserve.co.uk)
>
>
Technical Details
Message-ID: <uWpY3.1595$54.51182@news.uswest.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <80q9dc$pno$1@news7.svr.pol.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,905daaa275364cdd
X-Google-Attributes: gid111d45,public
X-Google-Thread: f5d71,905daaa275364cdd
X-Google-Attributes: gidf5d71,public
X-Google-Thread: 10fd6d,905daaa275364cdd
X-Google-Attributes: gid10fd6d,public
X-Google-Thread: 10a146,905daaa275364cdd
X-Google-Attributes: gid10a146,public
X-Google-Thread: 113ae9,905daaa275364cdd
X-Google-Attributes: gid113ae9,public
From: "Joe Mayo" <mayoj@uswest.net>
Subject: Re: Using JEditorPane to Display a Local HTML file
Date: 1999/11/16
Message-ID: <uWpY3.1595$54.51182@news.uswest.net>
X-Deja-AN: 549560160
References: <80q9dc$pno$1@news7.svr.pol.co.uk>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
X-Trace: news.uswest.net 942811930 207.225.30.186 (Tue, 16 Nov 1999 22:12:10 CST)
X-MSMail-Priority: Normal
NNTP-Posting-Date: Tue, 16 Nov 1999 22:12:10 CST
Newsgroups: borland.public.jbuilder.java.swing,comp.lang.java,comp.lang.java.gui,comp.lang.java.help,comp.lang.java.programmer