public final class Captcha extends Object
Example for generating a new captcha:
Captcha nl.captcha = new Captcha.Builder(200, 50)
.addText()
.addBackground()
.build();
Note that the build() must always be called last. Other methods are optional,
and can sometimes be repeated. For example:
Captcha nl.captcha = new Captcha.Builder(200, 50)
.addText()
.addNoise()
.addNoise()
.addNoise()
.addBackground()
.build();
Adding multiple background has no affect; the last background added will simply be the one that is eventually rendered.
| Modifier and Type | Class and Description |
|---|---|
static class |
Captcha.Builder
Captcha class builder.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getAnswer()
Returns the answer for captcha.
|
BufferedImage |
getImage()
Get the PNG captcha image.
|
boolean |
isCorrect(String answer)
Returns true if specified answer if correct, otherwise false.
|
public boolean isCorrect(String answer)
answer - answer for captcha.public String getAnswer()
public BufferedImage getImage()
Copyright © 2015. All rights reserved.