⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 backgroundcontroller.groovy

📁 一个为 Java/J2EE生成的最简化CAPTCHA的框架
💻 GROOVY
字号:
import java.awt.Colorimport nl.captcha.Captchaimport nl.captcha.backgrounds.*import nl.captcha.servlet.CaptchaServletUtil/** * Exercise the various background renderers.**/class BackgroundController {    def final WIDTH = 200    def final HEIGHT = 50    def simple = {        def captcha = new Captcha.Builder(WIDTH, HEIGHT)            .addText()            .addBackground()            .build()        CaptchaServletUtil.writeImage(response, captcha.image)    }    def squiggles = {        def captcha = new Captcha.Builder(WIDTH, HEIGHT)            .addText()            .addBackground(new SquigglesBackgroundProducer())            .build()        CaptchaServletUtil.writeImage(response, captcha.image)    }    def flatcolor = {        def captcha = new Captcha.Builder(WIDTH, HEIGHT)            .addText()            .addBackground(new FlatColorBackgroundProducer())            .build()        CaptchaServletUtil.writeImage(response, captcha.image)    }    def blue = {        def captcha = new Captcha.Builder(WIDTH, HEIGHT)            .addText()            .addBackground(new FlatColorBackgroundProducer(Color.BLUE))            .build()        CaptchaServletUtil.writeImage(response, captcha.image)    }    def gradiated = {        def captcha = new Captcha.Builder(WIDTH, HEIGHT)            .addText()            .addBackground(new GradiatedBackgroundProducer())            .build()        CaptchaServletUtil.writeImage(response, captcha.image)    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -