Package nl.captcha

Class Captcha

java.lang.Object
nl.captcha.Captcha
All Implemented Interfaces:
Serializable

public final class Captcha extends Object implements Serializable
A builder for generating a CAPTCHA image/answer pair.

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);
See Also: