java 通过Color设置Font

时间:2020-05-18 00:01:02   收藏:0   阅读:71
 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));

 

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

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!