Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Load HTML page in to JEditorPane?

 
Jimmy Nilsson
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of "TESTPROG\\default.html" have you tried "TESTPROG/default.html"? I think that'll work on Windows, Linux, UNIX, and Mac OS.
 
Jez Nicholson
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic