⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testvalidcode.java

📁 创建网页页面验证的验证码
💻 JAVA
字号:
package mawen.test;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.imageio.stream.FileImageOutputStream;

import junit.framework.TestCase;
import mawen.util.ValidCode;

public class TestValidCode extends TestCase {
	public static void testVC() throws FileNotFoundException, IOException {
		File f = new File("E:\\downloads\\vc.jpg");
		FileImageOutputStream fo = new FileImageOutputStream(f);
		ValidCode vc= new ValidCode();
		BufferedImage image = vc.getImage();
		System.out.println(vc.getValidString());
		ImageIO.write(image, "JPEG", fo);
		fo.flush();
		fo.close();
	}
	
	public static void testNullString() {
		String str=null;
		System.out.println(str);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -