渐变效果文字

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);

}
}

posted @ 2015-04-27 17:36  ma_fighting  阅读(168)  评论(0编辑  收藏  举报
历史天气查