是否可以通过样式隐藏文本?
我目前有一个 JTextPane 将显示来自不同流的文本。用户可以辨别文本来自哪个流的方式是来自每个流的文本具有不同的样式。有没有办法制作隐藏文本的样式,以便我可以过滤掉不同的文本片段?
谢谢。
I currently have a JTextPane that will be displaying text coming in from different streams. The way that the user can tell which stream the text came from is that the text from each stream has a different Style to it. Is there a way to make a Style that will hide the text so that I can filter out different pieces of text?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以(某种程度上)通过使用 0 字体大小并匹配组件的背景来伪造它:
上面不可见字符串的长度似乎甚至对可见组件之间的空间没有影响。但请放心,它仍然在那里,从窗格中复制即可证明这一点。
You can (kind of) fake it by using a 0 font size and matching the background of the component:
The length of the invisible string above doesn't even seem to have an affect on the space between the visible components. But rest assured it's still there, as copying from the pane will prove.