• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Load HTML page in to JEditorPane?

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic