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

📄 main.fx

📁 一个为 Java/J2EE生成的最简化CAPTCHA的框架
💻 FX
字号:
/* * Main.fx * * Created on Jan 4, 2009, 7:11:10 PM */package simplecaptcha;import nl.captcha.backgrounds.GradiatedBackgroundProducer;import nl.captcha.Captcha;import nl.captcha.text.producer.ChineseTextProducer;import javafx.animation.Interpolator;import javafx.animation.KeyFrame;import javafx.animation.Timeline;import javafx.scene.effect.DropShadow;import javafx.scene.image.Image;import javafx.scene.image.ImageView;import javafx.scene.paint.Color;import javafx.scene.paint.RadialGradient;import javafx.scene.paint.Stop;import javafx.scene.Scene;import javafx.scene.shape.Circle;import javafx.scene.text.Font;import javafx.scene.text.Text;import javafx.scene.text.TextAlignment;import javafx.scene.transform.Scale;import javafx.stage.Stage;/** * SimpleCaptcha example using JavaFX * * @author <a href="james.childers@gmail.com">James Childers</a> */def width = 250;def height = 50;var scale = 1.0;var color = Color.YELLOW;def captcha = new Captcha.Builder(width, height)    .addText(new ChineseTextProducer())    .gimp()    .addNoise()    .addNoise()    .addBackground(new GradiatedBackgroundProducer())    .build();Timeline {    repeatCount: Timeline.INDEFINITE    autoReverse: true    keyFrames: [        KeyFrame {            time: 2.5s            canSkip: true            values: [                scale => -1.0 tween Interpolator.LINEAR            ]        }    ]}.play();Stage {    title: "A CAPTCHA"    width: width    height: height + 50 // Add 50 for the answer    scene: Scene {        content: [            Text {                font: Font {                    size: 16                }                x: 10,                y: height                textAlignment: TextAlignment.CENTER                content: "Answer: {captcha.getAnswer()}"            }            ImageView {                transforms: Scale {                    x: 1                    y: bind scale                    pivotX: 25,                    pivotY: 25                }                image: Image.fromBufferedImage(captcha.getImage())            }        ]    }}

⌨️ 快捷键说明

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