R
Red Orchid
See this code.
<code>
// JDK 1.5.0_11
void process() throws BadLocationException {
String s = "\r\n12345\r\n6890";
JTextPane p0 = new JTextPane();
JTextPane p1 = new JTextPane();
///////////////////////////////////
// Irrelevant to this issue
// p0.getDocument().putProperty(DefaultEditorKit.EndOfLineStringProperty, "\r\n");
// p1.getDocument().putProperty(DefaultEditorKit.EndOfLineStringProperty, "\r\n");
///////////////////////////////////
p0.setText(s);
p1.getDocument().insertString(0, s, null);
String r0 = p0.getText();
String r1 = p1.getText();
System.out.println(r0.equals(r1));
}
</code>
I expected that "true" is printed. But the code above prints "false".
Why ? Is it proper behavior of JTextPane ?
Thanks.
<code>
// JDK 1.5.0_11
void process() throws BadLocationException {
String s = "\r\n12345\r\n6890";
JTextPane p0 = new JTextPane();
JTextPane p1 = new JTextPane();
///////////////////////////////////
// Irrelevant to this issue
// p0.getDocument().putProperty(DefaultEditorKit.EndOfLineStringProperty, "\r\n");
// p1.getDocument().putProperty(DefaultEditorKit.EndOfLineStringProperty, "\r\n");
///////////////////////////////////
p0.setText(s);
p1.getDocument().insertString(0, s, null);
String r0 = p0.getText();
String r1 = p1.getText();
System.out.println(r0.equals(r1));
}
</code>
I expected that "true" is printed. But the code above prints "false".
Why ? Is it proper behavior of JTextPane ?
Thanks.