Running Text vertikal yang dinamis

November 3, 2009

import javafx.scene.shape.Line;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.transform.Translate;
import javafx.animation.Timeline;
import javafx.animation.KeyFrame;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import javafx.ext.swing.SwingTextField;
/**
* @author bhangun
*/

// y variable updated periodically
var y : Number = 200;

// Timeline updates y variable
var timeline : Timeline = Timeline {
repeatCount: Timeline.INDEFINITE
keyFrames :
KeyFrame {
time : 16ms
action : function() : Void {
y -= 1;
if( y == -1 ) { y = 200 }
}
}
};
var teksf:SwingTextField=SwingTextField {
columns: 10
//text: bin;
editable: true
};
Stage {
scene : Scene {
fill : Color.WHITE
content : [ teksf,
Text {
font : Font {
size: 24
}
transforms : [ Translate { y : bind y }]
content: bind teksf.text;
x: 10
}]
}

title : “Linear”
width : 200
height : 232
}

// Start animation
timeline.play();