import javafx.animation.*;
import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.util.Duration;
public class FxScroller extends Application
{
@Override
public void start( Stage stage )
{
Text text = new Text( 600, 20, "It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire." );
new Timeline( new KeyFrame( Duration.seconds( 20 ),
new KeyValue( text.xProperty(), -text.getBoundsInLocal().getWidth() - 1) ) ) .play();
stage.setScene( new Scene( new Group( text ), 600, 30 ) );
stage.show();
}
public static void main( String[] args )
{
launch( args );
}
}
Ähnliche Beiträge