?? main.fx
字號(hào):
/* * Main.fx * * Created on Jan 4, 2009, 7:11:10 PM */package simplecaptcha;import javafx.animation.Interpolator;import javafx.animation.KeyFrame;import javafx.animation.Timeline;import javafx.scene.image.Image;import javafx.scene.image.ImageView;import javafx.scene.paint.Color;import javafx.scene.Scene;import javafx.scene.text.Font;import javafx.scene.text.Text;import javafx.scene.text.TextAlignment;import javafx.scene.transform.Scale;import javafx.stage.Stage;import nl.captcha.backgrounds.GradiatedBackgroundProducer;import nl.captcha.Captcha;import nl.captcha.text.producer.ChineseTextProducer;/** * 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()) } ] }}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -