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.
我在 Swing 应用程序中使用 Flamingo/Substance,无法找到一种简单的方法来影响JCommandButton. 显式设置前景色似乎没有效果:
JCommandButton
JCommandButton button = new JCommandButton("Button"); button.setForeground(Color.red);
我必须扩展JCommandButton才能做到这一点吗?如果是这样,我该如何覆盖这种行为?谢谢。
我不确定这是否是首选的方法,但我最终扩展了委托以获得我想要的结果:
class CustomCommandButtonUI extends BasicCommandButtonUI { @Override protected Color getForegroundColor(boolean isTextPaintedEnabled) { return Color.red; } }