I have put up a Jcaptcha based on the example from the Jcaptcha site, but I need to configure the default jcaptcha with colors and fonts.
I managed to find this Configuration Jcaptcha with Spring, however this is with the use of Spring. I am a newbie with Java, and not using Spring, may I know how can I create new captcha configuration for my jcaptcha image?
Thank you in advance.
The example you are pointing to is, indeed, for Spring Framework. But thats is of little concern here. I can imagine the difficulty one might have, who has no idea about how dependency injection works. So here is the same thing programmatically. Note, I will cut it short for brevity.
com.octo.captcha.image.gimpy.GimpyFactorycom.octo.captcha.engine.GenericCaptchaEnginecom.octo.captcha.service.multitype.GenericManageableCaptchaServiceNow about the colors and fonts. You will need to give information about colors and fonts to your captcha factory. How? Here you go,
com.octo.captcha.component.wordgenerator.DictionaryWordGeneratorandcom.octo.captcha.component.image.wordtoimage.ComposedWordToImage, respectivelycom.octo.captcha.component.image.fontgenerator.RandomFontGeneratorwith your choice of available fonts and pass that to the factorycom.octo.captcha.component.image.backgroundgenerator.UniColorBackgroundGeneratorfor background color, andcom.octo.captcha.component.image.color.SingleColorGeneratorfor colorcom.octo.captcha.component.image.color.RandomRangeColorGenerator