java代码产生随机汉字 java 随机汉字( 二 )


int width=88;
int height=22;
BufferedImage img = new BufferedImage(width, height,BufferedImage.TYPE_INT_RGB);
Graphics g = img.getGraphics();
Graphics2D g2d = (Graphics2D) g;
g2d.setFont(new Font("黑体",Font.BOLD,17));
Random r = new Random();
for(int i=0;i4;i++){
String str = ""+r.nextInt(10);
AffineTransform aff = new AffineTransform();
aff.rotate(Math.random(),i*18,height-5);
aff.scale(0.6+Math.random(), 0.6+Math.random());
g2d.setTransform(aff);
g2d.drawString(str,i*18,height-5);
System.err.println(":"+str);
}
g2d.dispose();
ImageIO.write(img, "JPEG",resp.getOutputStream());
}
关于java代码产生随机汉字和java 随机汉字的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

推荐阅读