[英]How to make HtmlEditor default text to empty in javafx
I am having HTMLEditor, in that htmleditor by default i am getting <html><head></head><body></body></html>
text. 我有HTMLEditor,默认情况下,在该htmleditor中,我正在获取<html><head></head><body></body></html>
文本。 So when ever i am finding length in editor , minimum i am getting 62. But how to know whether HTMLEditor is empty or not 因此,无论何时我在编辑器中找到长度,最低我要达到62。但是如何知道HTMLEditor是否为空
Just set initial htmlText argument to an empty string 只需将初始htmlText参数设置为空字符串
@FXML
HTMLText text;
private void initialize() {
text.setHtmlText("");
}
Or directly in FXML file 或直接在FXML文件中
<HTMLEditor htmlText=""/>
The quick and practical way is to clear those texts 快速实用的方法是清除这些文本
htmleditor.getHtmlText()
.replace("<html><head></head><body>", "")
.replace("</body></html>", "")
.isEmpty();
However if you want a real emptiness of html content then it is a little hard. 但是如果你想要的HTML内容真实空虚那么它是一个有点硬。 Search the net with "java html strip tag" keywords. 用“ java html strip tag”关键字搜索网络。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.