Java 在禁用的文本字段中设置字体颜色
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3698859/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java set Font Color in a disabled Text Field
提问by Simiil
I have a disabled JTextField and due to readability problems i want to make the font black again. So that it looks like its not disabled, but i cant edit it. any suggestions?
我有一个禁用的 JTextField,由于可读性问题,我想让字体再次变黑。所以它看起来没有被禁用,但我无法编辑它。有什么建议?
回答by Faisal Feroz
回答by JohnoBoy
Try using the method setDisabledTextColor (inherited from JTextComponent)
尝试使用 setDisabledTextColor 方法(继承自 JTextComponent)
回答by Fauziya
Please use setDisabledTextColor(Color.BLACK)
to make your text color black.
请使用setDisabledTextColor(Color.BLACK)
使您的文本颜色变黑。