资源介绍
jsp登陆验证码生成源代码 ,java
import java.awt.image.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.imageio.*;
import com.sun.image.codec.jpeg.*;
import com.sun.image.codec.jpeg.JPEGCodec;
public class BuildImageServlet extends HttpServlet {
private Random generator = new Random();
private Color getRandColor(int fc, int bc) {
//给定范围获得随机颜色
Random random = new Random();
if (fc > 255) {
fc = 255;
}
if (bc > 255) {
bc = 255;
}
int r = fc + random.nextInt(bc - fc);
int g = fc + random.nextInt(bc - fc);
int b = fc + random.nextInt(bc - fc);
return new Color(r, g, b);
}
。。。。
- 上一篇: java注册登陆验证码实例
- 下一篇: C# 生成登陆验证码源码可以为数字也可为数字