Meaningless Drivel is fun!
The moose likes Swing / AWT / SWT and the fly likes Load HTML page in to JEditorPane? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Load HTML page in to JEditorPane?" Watch "Load HTML page in to JEditorPane?" New topic

Load HTML page in to JEditorPane?

Jimmy Nilsson

Joined: Sep 25, 2004
Posts: 26

I want to load a HTML page(that the program is creating) into a JEditorPane, but i get the wrong path!

Say that i have the html file in a catalog cald TESTPROG(TESTPROG\default.html) int this catalog(TESTPROG) i also got the project files(Im using JBuilder)

i using this cod pageURL = getClass().getResource("TESTPROG\\default.html");

this give me a error about error URL, i have tryed this to


and this works, but the program will be installd in different computers(diffrent catalogs) so i need it to take the html file that is located right in its own catalog even if its on the D och the C drive and so on.

I hope you know what im talking about ?

Jimmy Nilsson

Joined: Sep 25, 2004
Posts: 26
One Other thing!

Now i am using graphics(Onpaint) to draw the drawings to Display, if i want to make a HTML page of this instead, is there any way to place text and other stuff hust by gifing a point where is sholb be, och do i have to do everything with html code?

Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Instead of "TESTPROG\\default.html" have you tried "TESTPROG/default.html"? I think that'll work on Windows, Linux, UNIX, and Mac OS.

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Jez Nicholson
Ranch Hand

Joined: Oct 01, 2002
Posts: 39
if you want to change how the images in your html are displayed override the javax.swing.text.html.ImageView class. Then make your own HTMLEditorKit that makes a factory that returns your view.

I agree. Here's the link:
subject: Load HTML page in to JEditorPane?
It's not a secret anymore!