码迷,mamicode.com
首页 > 其他好文 > 详细

渐变效果文字

时间:2015-04-27 18:09:48      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:

public void paint(Graphics g) {
// TODO 自动生成的方法存根
Graphics2D g2=(Graphics2D)g;
// URL url=paint.class.getResource("qq.jpg");
// Image img=Toolkit.getDefaultToolkit().getImage(url);
//
//
// g2.drawImage(img, 200, 0,400,400,this);
int x=100;
int y=100;
String str=new String("mafeng");

Font font =new Font("华文行楷",Font.BOLD,72);
g2.setFont(font);
for(int i=0;i<8;i++){
x++;
y++;
g.drawString(str, x, y);
i++;
}
g2.setColor(Color.BLACK);
GradientPaint paint=new GradientPaint(0, 0, Color.blue, 100,100,Color.CYAN,true);
g2.setPaint(paint);
g2.drawString(str, x, y);

}
}

渐变效果文字

标签:

原文地址:http://www.cnblogs.com/mafeng/p/4460803.html

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