设置 JProgressBar 文本的颜色
我有这些进度条:
我正在尝试设置进度文本的颜色条,而不改变背景颜色或进度条本身的颜色。据我所知, setForeground() 设置文本和条形颜色?有没有一种方法可以做到一举两得?
I have these progress bars:
I'm trying to set the color of the TEXT of the progress bars, without changing the background color or the color of the progress bar itself. As far as I can tell, setForeground() sets both the text and the bar color? Is there a way to do one without the other?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
啊哈 - 看起来我可以修改 UI:
这有点令人困惑,因为前景和背景的使用并不直观。背景是条未覆盖文本时的文本颜色,前景是条覆盖文本时的文本颜色。
这是最终结果:
Ah ha - looks like I can modify the UI:
This was a bit confusing, since the use of Foreground and Background weren't intuitive. Background is the color of the text when the bar isn't covering it, foreground is the color of the text when it is.
Here's the end result:
通过带有 UIDefaults 的消息,
By message with UIDefaults,