博文

目前显示的是 2022的博文

Java Verify Code image

  /** Java  * create an image of the verify code */ public class VerifyCode { private int width = 100 ; // width of image private int height = 50 ; // height private String [] fontNames = { "Serif", "Sans Serif", "Slab Serif", "宋体" , "楷体" , "隶书" , "微软雅黑" }; private Color bgColor = new Color ( 255 , 255 , 255 ); // background private Random random = new Random (); private String codes = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" ; private String text ; // random /** * get Color * @return */ private Color randomColor () { int red = random . nextInt ( 150 ); int green = random . nextInt ( 150 ); int blue = random . nextInt ( 150 ); return new Color ( red , green , blue ); } /** * font type * @return */ private Font randomFont () { String name = fontNames