public abstract class Captcha extends Randoms
| 限定符和类型 | 字段和说明 |
|---|---|
protected String |
chars |
protected int |
charType |
static int[][] |
COLOR |
static int |
FONT_1 |
static int |
FONT_10 |
static int |
FONT_2 |
static int |
FONT_3 |
static int |
FONT_4 |
static int |
FONT_5 |
static int |
FONT_6 |
static int |
FONT_7 |
static int |
FONT_8 |
static int |
FONT_9 |
protected int |
height |
protected int |
len |
static int |
TYPE_DEFAULT |
static int |
TYPE_NUM_AND_UPPER |
static int |
TYPE_ONLY_CHAR |
static int |
TYPE_ONLY_LOWER |
static int |
TYPE_ONLY_NUMBER |
static int |
TYPE_ONLY_UPPER |
protected int |
width |
ALPHA, charMaxIndex, charMinIndex, lowerMaxIndex, lowerMinIndex, numMaxIndex, RANDOM, upperMaxIndex, upperMinIndex| 构造器和说明 |
|---|
Captcha() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected char[] |
alphas()
生成随机验证码
|
void |
checkAlpha()
检查验证码是否生成,没有则立即生成
|
protected Color |
color()
获取随机常用颜色
|
protected Color |
color(int fc,
int bc)
给定范围获得随机颜色
|
void |
drawBesselLine(int num,
Color color,
Graphics2D g)
随机画贝塞尔曲线
|
void |
drawBesselLine(int num,
Graphics2D g)
随机画贝塞尔曲线
|
void |
drawLine(int num,
Color color,
Graphics2D g)
随机画干扰线
|
void |
drawLine(int num,
Graphics2D g)
随机画干扰线
|
void |
drawOval(int num,
Color color,
Graphics2D g)
随机画干扰圆
|
void |
drawOval(int num,
Graphics2D g)
随机画干扰圆
|
int |
getCharType() |
Font |
getFont() |
int |
getHeight() |
int |
getLen() |
int |
getWidth() |
abstract boolean |
out(OutputStream os)
验证码输出,抽象方法,由子类实现
|
void |
setCharType(int charType) |
void |
setFont(Font font) |
void |
setFont(int font) |
void |
setFont(int font,
float size) |
void |
setFont(int font,
int style,
float size) |
void |
setHeight(int height) |
void |
setLen(int len) |
void |
setWidth(int width) |
String |
text()
获取当前的验证码
|
char[] |
textChar()
获取当前验证码的字符数组
|
abstract String |
toBase64()
输出base64编码
|
String |
toBase64(String type)
输出base64编码
|
public static final int[][] COLOR
public static final int TYPE_DEFAULT
public static final int TYPE_ONLY_NUMBER
public static final int TYPE_ONLY_CHAR
public static final int TYPE_ONLY_UPPER
public static final int TYPE_ONLY_LOWER
public static final int TYPE_NUM_AND_UPPER
public static final int FONT_1
public static final int FONT_2
public static final int FONT_3
public static final int FONT_4
public static final int FONT_5
public static final int FONT_6
public static final int FONT_7
public static final int FONT_8
public static final int FONT_9
public static final int FONT_10
protected int len
protected int width
protected int height
protected int charType
protected String chars
protected char[] alphas()
protected Color color(int fc, int bc)
fc - 0-255bc - 0-255protected Color color()
public abstract boolean out(OutputStream os)
os - 输出流public abstract String toBase64()
public String text()
public char[] textChar()
public void checkAlpha()
public void drawLine(int num,
Graphics2D g)
num - 数量g - Graphics2Dpublic void drawLine(int num,
Color color,
Graphics2D g)
num - 数量color - 颜色g - Graphics2Dpublic void drawOval(int num,
Graphics2D g)
num - 数量g - Graphics2Dpublic void drawOval(int num,
Color color,
Graphics2D g)
num - 数量color - 颜色g - Graphics2Dpublic void drawBesselLine(int num,
Graphics2D g)
num - 数量g - Graphics2Dpublic void drawBesselLine(int num,
Color color,
Graphics2D g)
num - 数量color - 颜色g - Graphics2Dpublic Font getFont()
public void setFont(Font font)
public void setFont(int font)
throws IOException,
FontFormatException
public void setFont(int font,
float size)
throws IOException,
FontFormatException
public void setFont(int font,
int style,
float size)
throws IOException,
FontFormatException
public int getLen()
public void setLen(int len)
public int getWidth()
public void setWidth(int width)
public int getHeight()
public void setHeight(int height)
public int getCharType()
public void setCharType(int charType)
Copyright © 2019. All rights reserved.