Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1171 > unrolled thread
| Started by | "Phil Powell" <phil.powell@THRWHITE.remove-dii-this> |
|---|---|
| First post | 2011-04-27 15:31 +0000 |
| Last post | 2011-04-27 15:32 +0000 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.lang.java.gui
Is HTML rendering truly p "Phil Powell" <phil.powell@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
Re: Is HTML rendering tru "Natasha Lloyd" <natasha.lloyd@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
Re: Is HTML rendering tru "Oliver Wong" <oliver.wong@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
Re: Is HTML rendering tru "Rogan Dawes" <rogan.dawes@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
| From | "Phil Powell" <phil.powell@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:31 +0000 |
| Subject | Is HTML rendering truly p |
| Message-ID | <1173884498.618700.141780@n59g2000hsh.googlegroups.com> |
To: comp.lang.java.gui
I've noticed that there are a lot of bugs in the Sun bugs db related
specifically to HTML rendering using javax.swing.JEditorPane.
I wrote a class extending JEditorPane that I thought should allow for
"safer" HTML rendering, but on occasions I still get an
ArrayIndexOutOfBoundsException: -1 or EmptyStackException when trying
to use setText().
Here is the exception stack:
java.util.EmptyStackException
at java.util.Stack.peek(Stack.java:85)
at javax.swing.text.DefaultStyledDocument
$ElementBuffer.insertElement(DefaultStyledDocument.java:1667)
at javax.swing.text.DefaultStyledDocument
$ElementBuffer.insertUpdate(DefaultStyledDocument.java:1405)
at javax.swing.text.DefaultStyledDocument
$ElementBuffer.insert(DefaultStyledDocument.java:1275)
at
javax.swing.text.DefaultStyledDocument.insert(DefaultStyledDocument.java:
199)
at javax.swing.text.html.HTMLDocument.insert(HTMLDocument.java:
242)
at javax.swing.text.html.HTMLDocument
$HTMLReader.flushBuffer(HTMLDocument.java:3325)
at javax.swing.text.html.HTMLDocument
$HTMLReader.addContent(HTMLDocument.java:3265)
at javax.swing.text.html.HTMLDocument
$HTMLReader.addContent(HTMLDocument.java:3230)
at javax.swing.text.html.HTMLDocument
$HTMLReader.handleText(HTMLDocument.java:2180)
at
javax.swing.text.html.parser.DocumentParser.handleText(DocumentParser.java:
241)
at javax.swing.text.html.parser.Parser.handleText(Parser.java:
345)
at javax.swing.text.html.parser.Parser.endTag(Parser.java:427)
at javax.swing.text.html.parser.Parser.parseTag(Parser.java:
1807)
at
javax.swing.text.html.parser.Parser.parseContent(Parser.java:2044)
at javax.swing.text.html.parser.Parser.parse(Parser.java:2211)
at
javax.swing.text.html.parser.DocumentParser.parse(DocumentParser.java:
105)
at
javax.swing.text.html.parser.ParserDelegator.parse(ParserDelegator.java:
73)
at javax.swing.text.html.HTMLEditorKit.read(HTMLEditorKit.java:
230)
at javax.swing.JEditorPane.read(JEditorPane.java:556)
at javax.swing.JEditorPane.read(JEditorPane.java:584)
at javax.swing.JEditorPane$PageLoader.run(JEditorPane.java:
647)
The page loads just fine (albeit very VERY slowly), but these annoying
exceptions occur frequently and I have no way of catching them.
All this to ask: Is Java reliable for HTML rendering or should I bag
the idea that Java can do this?
Phil
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [next] | [standalone]
| From | "Natasha Lloyd" <natasha.lloyd@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:31 +0000 |
| Subject | Re: Is HTML rendering tru |
| Message-ID | <1173894610.564932.156570@p15g2000hsd.googlegroups.com> |
| In reply to | #1171 |
To: comp.lang.java.gui > All this to ask: Is Java reliable for HTML rendering or should I bag > the idea that Java can do this? The problem is not with Java the language, but with the component JEditorPane. More specifically, the problem is in the default HTMLEditorKit that is used by JEditorPane to render the HTML. As it says in the docs, the HTMLEditorKit only supports HTML 3.2, which is pretty inadequate nowadays. Instead of extending JEditorPane, you should probably look into third- party packages that are meant to handle this problem. I can't personally recommend any good free ones, but you can take a look at this website, which reviews a few: http://today.java.net/pub/a/today/2004/05/24/html-pt1.html. That website is pretty old (3 years) so you should just do a Google search for "Java HTML renderer" and take a look at what comes up. --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Oliver Wong" <oliver.wong@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:32 +0000 |
| Subject | Re: Is HTML rendering tru |
| Message-ID | <CTgMh.57210$Zb.997205@weber.videotron.net> |
| In reply to | #1171 |
To: comp.lang.java.gui
"Phil Powell" <phillip.s.powell@gmail.com> wrote in message
news:1173884498.618700.141780@n59g2000hsh.googlegroups.com...
[OP has had problems with JEditorPane and HTML]
>
> All this to ask: Is Java reliable for HTML rendering or should I bag
> the idea that Java can do this?
Java, the programming language, is just as suitable as any other
programming language for HTML rendering (see
http://en.wikipedia.org/wiki/Turing_complete).
One specific piece of code written in Java (e.g. JEditorPane) may be
bad at rendering HTML, just like one specific piece of code written in any
language might be bad at rendering HTML.
You may be interested in http://jrex.mozdev.org/ among other Java HTML
projects.
- Oliver
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Rogan Dawes" <rogan.dawes@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:32 +0000 |
| Subject | Re: Is HTML rendering tru |
| Message-ID | <ets3gi$803$1@wblv-ip-nnrp-1.saix.net> |
| In reply to | #1263 |
To: comp.lang.java.gui Oliver Wong wrote: > "Phil Powell" <phillip.s.powell@gmail.com> wrote in message > news:1173884498.618700.141780@n59g2000hsh.googlegroups.com... > [OP has had problems with JEditorPane and HTML] >> All this to ask: Is Java reliable for HTML rendering or should I bag >> the idea that Java can do this? > > Java, the programming language, is just as suitable as any other > programming language for HTML rendering (see > http://en.wikipedia.org/wiki/Turing_complete). > > One specific piece of code written in Java (e.g. JEditorPane) may be > bad at rendering HTML, just like one specific piece of code written in any > language might be bad at rendering HTML. > > You may be interested in http://jrex.mozdev.org/ among other Java HTML > projects. > > - Oliver > > Also take a look at xhtmlrenderer at dev.java.net Rogan --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.gui
csiph-web