Re: About JTextPane, Why "Not equal" ?
- From: "SadRed" <cardinal_ring@xxxxxxxxxxx>
- Date: 31 Mar 2007 03:11:35 -0700
On Mar 31, 6:13 pm, Tom Hawtin <use...@xxxxxxxxxxxxxxxxx> wrote:
Andrew Thompson wrote:
On Mar 31, 6:08 pm, "SadRed" <cardinal_r...@xxxxxxxxxxx> wrote:
On Mar 31, 4:50 pm, "Red Orchid" <windfollowcl...@xxxxxxxxx> wrote:..
...I expected that "true" is printed. But the code above prints "false".
It does print "true".
Not here. Using your code (or mine),
Java 1.6.0, on WinXP, I get 'false'.
I get 'true' on Ubuntu with Java 1.6.0 and 1.4.2_13.
I suspect it has something to do with the 'null'
character attribute set, but am not sure.
The code compares the raw text, so the attributes should come into it.
The difference between JEditorPane.setText and Document.insertString
(other than that one replaces, etc) is that setText goes through the
EditorKit (which then calls insertString). So you can setText an entire
HTML document, if the JEditorPane is so configured.
For plain text, the PlainEditorKit attempts to cope with different new
line standard. It may not pass through the text unchanged. Mixing new
line standards, makes it go false for me.
String s = "\r\n123\n45\r\n6890";
^^
Tom Hawtin
PlainEditorKitIt's DefaultEditorKit. I saw the source code of
its read() method. And I just saw it is playing
with various line-end markers, '\n', '\r' and
'\r\n'. But nothing was clear to me. ;-)
.
- References:
- About JTextPane, Why "Not equal" ?
- From: Red Orchid
- Re: About JTextPane, Why "Not equal" ?
- From: SadRed
- Re: About JTextPane, Why "Not equal" ?
- From: Andrew Thompson
- Re: About JTextPane, Why "Not equal" ?
- From: Tom Hawtin
- About JTextPane, Why "Not equal" ?
- Prev by Date: Re: Bounce off
- Next by Date: Re: About JTextPane, Why "Not equal" ?
- Previous by thread: Re: About JTextPane, Why "Not equal" ?
- Next by thread: Re: About JTextPane, Why "Not equal" ?
- Index(es):
Relevant Pages
|