I need to add a captcha validator in a java swing application. I have been searching some libraries (JCaptcha and SimpleCatcha) but they are for web development.
Is there any library to use captcha on swing? and if it's not, is there a web page or repository with some captcha caracters to implement my own captcha?
I really appreciate your time and your help.
Thanks in advance.
JCaptcha can return a BufferedImage. From there it is not much difficult to get the image visible using a JLabel:
BufferedImage captcha = // Get the captcha
// See also com.octo.captcha.service.image.AbstractManageableImageCaptchaService.getImageChallengeForID(String)
JLabel label = new JLabel(new ImageIcon(captcha));
// ... add that label to a visible container of your Swing application
In version 1.0, you can use this: http://jcaptcha.sourceforge.net/apidocs/1.0/com/octo/captcha/service/image/AbstractManageableImageCaptchaService.html
In 2.0-alpha1, there is this: http://jcaptcha.sourceforge.net/apidocs/2.0-alpha1/com/octo/captcha/service/image/AbstractManageableImageCaptchaService.html#getImageChallengeForID(java.lang.String)
You can also check the overloaded version of those methods with an extra Locale
argument.
In each case, there is a default implementing class DefaultManageableImageCaptchaService
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With