禁用JTextField背景色

禁用JTextField背景色

本文介绍了启用/禁用JTextField背景色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在禁用JTextField时,我将其背景颜色更改为黑色.我使用UIManager和此属性TextField.disabledBackground(在应用程序启动时设置)进行此操作.我想知道当再次启用JTextField时如何更改背景颜色吗?谢谢.

i changed the background color of my JTextField to black when it is disabled. I do this using the UIManager and this property TextField.disabledBackground, that i set at application start up. I would like to know how can i change the background color when the JTextField is enabled again ?Thank you.

推荐答案

看看 http://tips4java.wordpress.com/2008/10/09/uimanager-defaults/在此处运行webstart应用程序,或下载代码并自己运行该实用程序.您想要的可能是"TextField.background",但是有了属性列表和默认值列表,您会找到我认为正确的列表.

Have a look at http://tips4java.wordpress.com/2008/10/09/uimanager-defaults/ Run the webstart app there, or download the code and run that utility yourself. What you want might be "TextField.background", but armed with the list of properties and defaults, you'll find the right one I bet.

这篇关于启用/禁用JTextField背景色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 16:34