File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Load HTML page in to JEditorPane?" Watch "Load HTML page in to JEditorPane?" New topic
Author

Load HTML page in to JEditorPane?

Jimmy Nilsson
Greenhorn

Joined: Sep 25, 2004
Posts: 26
Hey

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

java.net.URL pageURL = getClass().getResource("TESTPROG\\default.html");
JEditorPane.setPage(pageURL);

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

JEditorPane.setPage(//"file:/c:/TESTPROG/default.html");

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
Jimmy Nilsson
Greenhorn

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?

//Jimmy
Dirk Schreckmann
Sheriff

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.

 
Consider Paul's rocket mass heater.
 
subject: Load HTML page in to JEditorPane?