Results 1 to 5 of 5
- 09-21-2010, 09:58 AM #1
Senior Member
- Join Date
- Apr 2010
- Location
- Philippines
- Posts
- 580
- Rep Power
- 4
HTML and CSS in JEditorPane.setPage
Hi, I am trying to create a HTML help file and load it in Editor pane but it only show the texts but do not follow the
css code inside the html file
Here is the HTML file code:
I am trying to load it like thisJava Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <style type="text/css"> ul { list-style-type:none; margin:0; padding:0; } li { display:inline; } </style> <title></title> </head> <body bgcolor = "rgb('102,102,102')"> <div style="width:400px;; background:#FFFFFF"> <ul> <li>menu 1</li> <li>menu 2</li> <li>menu 3</li> <li>menu 4</li> </ul> </div> </body> </html>
Thanks,Java Code:private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { try { String url = "file:///" + System.getProperty("user.dir") + "\\src\\folder\\Help\\"; JEditorPane1.setContentType("text/html"); JEditorPane1.setPage(url + "Help.html"); } catch(Exception ex) { ex.printStackTrace(); } }
geje
- 09-21-2010, 10:04 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,606
- Blog Entries
- 7
- Rep Power
- 17
What happens if you set the content type to "text/html"?
kind regards,
Jos
edit: hrmph, you edited your OP so ignore this reply ...
- 09-22-2010, 02:38 AM #3
Senior Member
- Join Date
- Apr 2010
- Location
- Philippines
- Posts
- 580
- Rep Power
- 4
@JosAh: im sorry, i just did not notice that the sample does not have "text/html" but the actual code has a contentType.
Also, I did not see your reply before I edit it...
I change
I also notice that the bullets in lists gone which means that JEditorPane was able to read the css but notJava Code:<div style="width:400px;; background:#FFFFFF"> [b]to[/b] <div style="width:400px; background:#FFFFFF">
Why?Java Code:li { display: inline; }
I have try to run this HTML in google chrome and the output is ok.
Thanks,
geje
- 09-22-2010, 08:28 AM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,606
- Blog Entries
- 7
- Rep Power
- 17
- 09-22-2010, 09:21 AM #5
Senior Member
- Join Date
- Apr 2010
- Location
- Philippines
- Posts
- 580
- Rep Power
- 4
Similar Threads
-
Format editing in HTML view with JEditorPane
By peterme in forum Advanced JavaReplies: 4Last Post: 02-23-2011, 09:05 PM -
Help -- Jeditorpane doesnot support HTML Images for baseline
By sharma_ram in forum AWT / SwingReplies: 1Last Post: 01-22-2010, 05:23 PM -
JEditorPane, HTML 4.0, CSS, custom Tags
By AndreB in forum AWT / SwingReplies: 4Last Post: 12-22-2009, 10:45 AM -
setPage
By prof.deedee in forum AWT / SwingReplies: 5Last Post: 11-11-2009, 01:43 AM -
jeditorpane help parsing html
By asifsolkar in forum Advanced JavaReplies: 4Last Post: 12-14-2007, 05:23 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks