Clear text on SVG text

205 views Asked by At

I am working with a java project, which it uses an SVG element from SVG Salamander lib and this element uses a Text form. The program writes on the text when a device is disconnected, using Text.append() the following legend is added

No Data from the device: Blockquote

but when the device is again reconnected this legend should be gone, but using text.append(""), the old message is still there. I've read this link. At the end, the question is how to clear the text from SVGElement?

1

There are 1 answers

0
Robert Longson On BEST ANSWER

The Text class has a linked list content member.

To append to the list you append to the content member so to delete content you need to remove things from content. To delete everything therefore you'd want to call

text.getContent().clear();