【发布时间】:2013-01-10 09:56:11
【问题描述】:
我想要的是使不可编辑的文本区域的背景与其禁用的背景相同。
我知道颜色可以从UIManager 用键TextArea.disabled 获得:
DerivedColor(color=214,217,223 parent=control offsets=0.0,0.0,0.0,0 pColor=214,217,223
我第一次尝试:
textArea.setBackground(UIManager.getColor("TextArea.disabled"));
什么都没变,背景还是白色的。
然后我尝试了:
textArea.setBackground(new Color(UIManager.getColor("TextArea.disabled").getRGB()));
背景确实发生了变化,但与看起来更亮的禁用背景并不完全相同。
处理这种派生颜色的正确方法是什么?
【问题讨论】:
-
查看关于外观和感觉的 Oracle 教程,覆盖 JTextArea 的正确键
-
无法编辑背景没有键。
标签: java swing user-interface look-and-feel nimbus