TextArea with setWordWrap(false) replaces all '\n' with '\r' if we edit the text. If the text is not edited, then, it is not affected this way.
Test code:
(Click 'Show' button before editing and see the positions of '\n' and '\r'. Do it again after editing and watch the values.)
Also, this effect is not there if setWordWrap(false) line is commented out.
package test;
import org.jseamless.*;
import org.jseamless.container.*;
import org.jseamless.event.*;
import org.jseamless.style.*;
public class Test extends Application {
public Test() {
super("Test");
addWindow(new TWindow());
}
class TWindow extends Window {
public TWindow() {
super("TextArea Test");
TextArea text = new TextArea();
text.setWordWrap(false);
text.setText("This is the initial text.\nAnd, this is the second line.");
add(text);
add(new HorizontalBox(text));
}
}
class HorizontalBox extends Box implements EventListener {
private Label display;
private TextArea text;
public HorizontalBox(TextArea text) {
super();
this.text = text;
setLayout(Layout.HORIZONTAL);
setHorizontalSpacing(5);
Button b = new Button("Show");
b.addEventListener(this);
add(b);
add(display = new Label(""));
}
public void eventOccurred(Event e) {
if(e.getType() == EventType.CLICK) {
display.setText("\\n @ " + text.getText().indexOf('\n') + " and \\r @ " + text.getText().indexOf('\r'));
}
}
}
}