英文:
Right way to display escape characters as tooltip in swing java application
问题
我正在使用setToolTipText方法在我的Java应用程序中设置工具提示文本。
jTextField1.setToolTipText("<html>" + "Line One" + "<br>" + "Line 2" + "</html>");
这在没有转义字符的情况下工作正常。但是,如果文本中有\b
这个转义字符,工具提示中会显示一个小框。
应该如何正确地将这个\b
显示为工具提示中的原始文本?
英文:
I am using setToolTipText method to set the tooltip text in my java application
jTextField1.setToolTipText("<html>" + "Line One" +"<br>" + "Line 2" + "</html>");
This works fine unless a escape character comes in. Lets say if '\b' it present in the text, a small box is displayed in the tooltip.
What would be the right way to display this '\b' as is in the tooltip ?
专注分享java语言的经验与见解,让所有开发者获益!
评论