一个简单的问题求大家,jtextfield中的字体颜色能设置吗??
来源:百度知道 编辑:UC知道 时间:2024/06/20 11:05:46
据我所知不能,不过你可以改变背景色,这样也很美观的
jTextfield.setBackground(Clour.BLUE);
好像有个前景色可以设置,我忘了...自己查查吧
JTextField jf = new JTextField("<html><font color=red>");
使用如 jTextfield.setForeground(Clour.RED);
setForeground
public void setForeground(Color fg)设置此组件的前景色。由外观来决定是否遵守此属性,某些外观可以选择忽略它。
覆盖:
类 Component 中的 setForeground
参数:
fg - 所需的前景 Color
另请参见:
Component.getForeground()