gpt4 book ai didi

java - 如何更改 JEditorPane 中选定文本的颜色?

转载 作者:行者123 更新时间:2023-12-01 17:21:42 26 4
gpt4 key购买 nike

我目前正在开发一个程序,允许您使用 setSelectedTextColor (Color.red)JEditorPane 更改所选文本的颜色,但它只是暂时的当我用光标运行时更改文本。

我想知道如何设置或更改它,以及setForeground

最佳答案

也许这篇文章可以帮助您:Changing color of selected text in jTextPane

这里使用 jTextPane 而不是 jEditorPane,我搜索过 jEditorPane 并说它比 jEditorPane 更好地支持颜色更改。

如果这不起作用,请在 Google 中搜索您的问题,如果找到,我们将非常感谢您将其发布到此处。谢谢。

关于java - 如何更改 JEditorPane 中选定文本的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61281239/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com