public final class Captcha extends Object implements Serializable
Example for generating a new CAPTCHA:
Captcha 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 captcha = new Captcha.Builder(200, 50)
.addText()
.addNoise()
.addNoise()
.addNoise()
.addBackground()
.build();
Adding multiple backgrounds has no affect; the last background added will simply be the one that is eventually rendered.
To validate that answerStr is a correct answer to the CAPTCHA:
captcha.isCorrect(answerStr);| 限定符和类型 | 类和说明 |
|---|---|
static class |
Captcha.Builder |
Copyright © 2015. All rights reserved.