首页 > 编程语言 > 详细

java 通过Color设置Font

时间:2020-05-18 00:01:02      阅读:68      评论:0      收藏:0      [点我收藏+]
 1         //文本颜色
 2         Paint paint = new Color(44, 67, 85);
 3         //文字样式
 4         Font f = new Font("仿宋", Font.PLAIN, 18);
 5         
 6         //将上面样式放入Map内
 7         HashMap<TextAttribute, Object> textAttributes = new HashMap<TextAttribute, Object>();
 8         textAttributes.put(TextAttribute.FONT, f);
 9         textAttributes.put(TextAttribute.BACKGROUND, paint);
10         
11         //新建拥有上面样式的文字
12         textArea.setFont(new Font(textAttributes));

 

java 通过Color设置Font

原文:https://www.cnblogs.com/gulu-miao/p/12907718.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!