Re: About JTextPane, Why "Not equal" ?
- From: Tom Hawtin <usenet@xxxxxxxxxxxxxxxxx>
- Date: Sat, 31 Mar 2007 10:13:27 +0100
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
.
- Follow-Ups:
- Re: 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" ?
- 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
- About JTextPane, Why "Not equal" ?
- Prev by Date: Re: Jframe
- Next by Date: Re: Desktop Java app: 3D photo-sharing
- Previous by thread: Re: About JTextPane, Why "Not equal" ?
- Next by thread: Re: About JTextPane, Why "Not equal" ?
- Index(es):
Relevant Pages
|