java设置字体颜色
发布时间: 2023-01-24 05:48:37
㈠ java中怎么改变字体颜色
字体大小及颜色
a:Java代码区域的字体大小和颜色:
window -- Preferences -- General -- Appearance -- Colors And Fonts -- Java修改 -- Java Edit Text Font
b:控制台
window -- Preferences -- General -- Appearance -- Colors And Fonts -- Debug -- Console font
c:其他文件
window -- Preferences -- General -- Appearance -- Colors And Fonts -- Basic -- Text Font
㈡ java中如何让字体变色
简单设置如下:
jlabel.setFont(new java.awt.Font("Dialog", 1, 15));
“dialog”代表字体,1代表样式(1是粗体,0是平常的)15是字号
//设置字体
jlabel.setForeground(Color.red);
//设置颜色
㈢ 请问java中怎样设置字体的颜色
下拉框和textfield,textarea这些控件都有setforeground方法,这个函数是设置前景色的,设置为红色就行了.
例如:textfield
txt=new
textfield("请输入姓名");
txt.setforeground(color.red);
热点内容