Re: About JTextPane, Why "Not equal" ?



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
.



Relevant Pages

  • Re: About JTextPane, Why "Not equal" ?
    ... I get 'true' on Ubuntu with Java 1.6.0 and 1.4.2_13. ... character attribute set, but am not sure. ... So you can setText an entire ... line standard. ...
    (comp.lang.java.programmer)
  • Transponder Protocol Open Standard rec.pets-2005a
    ... But anybody can write an open standard, ... transponders readable by the standard is not intended to be identical ... as 20 character readings under this standard unless the reader designer ... If an excerpt string shows four or fewer transitions ...
    (rec.pets)
  • Re: Herbert Schildt, author of The Complete C++ Reference (NOT C Unleashed) rehabilitated on wikiped
    ... well as on Amazon and wikipedia, on Schildt, Heathfield et al. did try ... Annotated Annotated C Standard" at http://www.lysator.liu.se/c/schildt.html, ... auditing EACH AND EVERY LINE for character width dependent operations ... standard (something that is not mentioned in the annotations), ...
    (comp.programming)
  • Re: Questions on reuse of FORMAT statements and newer I/O options ?such as ACCESS=STREAM
    ... I might believe that character oriented file systems are the worst ... but nothing in the standard ... That works when using only Fortran I/O. ...
    (comp.lang.fortran)
  • Re: Segfault City
    ... Those who ignore the standard library condemn themselves to rewriting it. ... programmers have to use a dictated and not fully standard compiler. ... I'm saying that to rely on character ordering that is not guaranteed ...
    (comp.lang.c)