Article View: borland.public.jbuilder.java.swing
Article #10085Re: Using JEditorPane to Display a Local HTML file
From: David Harrison
Date: Wed, 17 Nov 1999 00:00
Date: Wed, 17 Nov 1999 00:00
43 lines
2325 bytes
2325 bytes
Many thanks!
Joe Mayo <mayoj@uswest.net> wrote in message
news:uWpY3.1595$54.51182@news.uswest.net...
> 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:
<80u6dq$1f7$1@news7.svr.pol.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<80q9dc$pno$1@news7.svr.pol.co.uk> <uWpY3.1595$54.51182@news.uswest.net>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: 10fd6d,905daaa275364cdd X-Google-Attributes: gid10fd6d,public X-Google-Thread: 10a146,905daaa275364cdd X-Google-Attributes: gid10a146,public X-Google-Thread: f5d71,905daaa275364cdd X-Google-Attributes: gidf5d71,public X-Google-Thread: 113ae9,905daaa275364cdd X-Google-Attributes: gid113ae9,public From: "David Harrison" <dl@harrison99.fsbusiness.co.uk> Subject: Re: Using JEditorPane to Display a Local HTML file Date: 1999/11/17 Message-ID: <80u6dq$1f7$1@news7.svr.pol.co.uk> X-Deja-AN: 549670473 References: <80q9dc$pno$1@news7.svr.pol.co.uk> <uWpY3.1595$54.51182@news.uswest.net> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 X-Complaints-To: abuse@theplanet.net X-Trace: news7.svr.pol.co.uk 942841082 1511 62.137.42.129 (17 Nov 1999 12:18:02 GMT) Organization: Customer of Planet Online X-MSMail-Priority: Normal NNTP-Posting-Date: 17 Nov 1999 12:18:02 GMT Newsgroups: borland.public.jbuilder.java.swing,comp.lang.java,comp.lang.java.gui,comp.lang.java.help,comp.lang.java.programmer