Hi,
Below is attached the code I use: First of all, I fill in the text of
the textArea as follows (targetsSelected is a listBox):
String txt = "";
for (int i = 0; i < targetsSelected.getItemCount(); i++)
txt += (targetsSelected.getItemText(i) + "\r\n");
TextArea ta = new TextArea();
ta.setText(txt);
[...]
Later in the code I need to read the content of the TextArea and get
each element writen before:
int i = 0;
while (i < ta.getText().length())
{
String ip = ta.getText().substring(i, (ta.getText().indexOf("\r\n",
i)));
System.out.println("-------------------IP: " + ip);
i = ta.getText().indexOf("\r\n", i) + 1;
}
And what is printed is the following:
-------------------IP: 1.1.1.4
-------------------IP:
1.1.1.7
-------------------IP:
1.1.1.8
As you can see the second and third element have one newline at the
begining and at the end, and I can't undersand why...
Can you help me please?
Lothar, to enter text into an HTMLwidget you can use the operation
setText.