码迷,mamicode.com
首页 > 编程语言 > 详细

java 通过Color设置Font

时间:2020-05-18 00:59:15      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:back   round   div   shm   style   obj   nbsp   paint   bsp   

 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

标签:back   round   div   shm   style   obj   nbsp   paint   bsp   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!