Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想更改从用户输入中找到的字符串的颜色JTextArea。我一直在互联网上搜索,但找不到解决方案。我知道 JTextPane 可以很容易地处理这种样式,但我不熟悉JTextPane它的功能。例如,我不知道如何启用我可以在文本区域轻松完成的自动换行和换行。
JTextArea
JTextPane
那么有没有办法改变字符串的颜色JTtextArea呢?
JTtextArea
要么使用可以采用多种字体和格式的 JEditorPane,要么设置文本区域的背景/前景色。
setForeground(Color Object Here); setBackground(Color Object Here);