简体   繁体   English

清除SVG文字上的文字

[英]Clear text on SVG text

I am working with a java project, which it uses an SVG element from SVG Salamander lib and this element uses a Text form. 我正在使用java项目,该项目使用SVG Salamander lib中的SVG元素,并且此元素使用Text形式。 The program writes on the text when a device is disconnected, using Text.append() the following legend is added 当设备断开连接时,程序将使用Text.append()写入文本,并添加以下图例

No Data from the device: Blockquote 设备无数据:Blockquote

but when the device is again reconnected this legend should be gone, but using text.append("") , the old message is still there. 但是当再次重新连接设备时,该图例应消失,而使用text.append("") ,旧消息仍然存在。 I've read this link . 我已阅读此链接 At the end, the question is how to clear the text from SVGElement? 最后,问题是如何清除SVGElement中的文本?

The Text class has a linked list content member. Text类具有链接列表内容成员。

To append to the list you append to the content member so to delete content you need to remove things from content. 要追加到列表,您要追加到content成员,以便删除内容,您需要从内容中删除内容。 To delete everything therefore you'd want to call 要删除所有内容,因此您要致电

text.getContent().clear();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM